javaweb to implement student management system (addition, deletion, change, login registration, paging display, blur inquiries, filter, verification code verification)

2022-12-26   ES  

directory

1、tuple

2, function

3, test


1、tuple

Tuple extends Pair to see the function of two elements as a unit, and realize the function that can treat any number of elements as a unit.

2, function

tuple <T1, t2 ... tn> t; Create Tuple with N given elements 
 Tuple <T1, t2 ... tn> t (v1, v2 ... vn); build tuple and initialize 
 Tuple <T1, T2> T (PAIR); Create a TPLE, with two elements 
 t = t2; assign the value t2 to T 
 t = Pair; assign pair to TPLE with two elements 
 T1 == T2; compare all elements 
 T1! = T2 
 T1 <T2 
 T1> T2 
 T1 <= t2 
 t1> = t2 
 t1.swap (t2); 
 swap (t1, t2); 
 make_tuple (v1, v2 ...); build Tuple to pass the type 
 tie (ref (1) ...; build a tuple composed of reference

3, test

#include <iOSTREAM> 
 #include <Tuple> 
 #include <string> 
 using namespace std; 

 template <th IDX, int Max, Typename ... ARGS> 
 struct Print_tuple { 
 Static Void Print (OSTREAM & OS, Const Tuple <args ...> & T) 
 {{ 
 OS << get <idx> (t) << (IDX + 1 == max? "": ":", "); 
 // recursion 
 Print_tuple <IDX + 1, MAX, ARGS ...> :: Print (OS, T); 
 } 
 }; 

 // End of recursion 
 template <th Max, Typename ... ARGS> 
 struct print_tuple <max, max, args ...> 
 {{ 
 Static Void Print (OSTREAM & OS, Const Tuple <args ...> & T) 
 {{ 

 } 
 }; 

 // Reight -load operation operating symbols << 
 template <typename ... args> 
 OSTREAM & Operator << (OSTREAM & OS, Const Tuple <args ...> & T) 
 {{ 
 os << "[";; 
 Print_tuple <0, sizeof ... (args), args ...> :: Print (OS, T); 
 Return os << "];; 
 } 

 int Main () 
 {{ 
 // Create 
 tuple <int, char, string> t; 
 t = Make_tuple (1, 'a', "abc"); 
 COUT << Get <0> (t) << ENDS << GET <1> (t) << ENDS <2> (t) .c_str () << Endl; 

 // Take your value 
 int a = 0; 
 char ch1 = ''; 
 String Str; 
 tie (a, ch1, str) = t; 
 copy << ENDS << ch1 << ENDS << Str.c_str () << Endl; 

 // This operation is not allowed, and implicit conversion is not allowed 
 // vector <Tuple <int, char, string >> v {{1, 'a', "abc"}, {2, 'b', "def"}}; 
 
 core << t << Endl; 

 // Get the element type 
 tuple_element <0, decltype (t)> :: Type ages; 
 // Get the number of elements 
 COUT << Tuple_size <Deckype (T)> :: Value << Endl; 
 System ("pause"); 
 }

source

Related Posts

IOS memory management and malloc source code interpretation

1 1 1 1 1 1

2021 CS Baoye Experience (2): Shanda CS Summer Camp, West Power CS Summer Camp Cyril

Computer network (7th edition) -Chapter 5 Transportation Layer -Important Concept

javaweb to implement student management system (addition, deletion, change, login registration, paging display, blur inquiries, filter, verification code verification)

Random Posts

IOS no bomber box changes icons, just use it directly

DFS and BFS algorithm Real

Python 3.8 version, install and use the Pymouse library

Ilruntime breakpoint debugging

Talk about Vue component welkin