本测试主要测试顺序容器的大部分通用函数的语法合理性
文件 | 测试用途 |
---|---|
def_and_init/*.cpp | 测试顺序容器的定义 |
assign_and_swap/*.cpp | 测试顺序容器的赋值和交换 |
access/*.cpp | 测试顺序容器的元素访问 |
add/*.cpp | 测试顺序容器的元素添加 |
del_item /*.cpp | 测试顺序容器的元素删除 |
comm.h | 宏公用文件 |
main.cpp | 主函数 |
def_and_init/def1.cpp
#include "../comm.h"
#define __DEF1(t1, t2) { \
t1 c1; \
cout << " 定义"#t1"<"#t2"> c1" << endl; \
}
#define __DEF1_A(t1, t2){ \
t18> c0; \
cout << " 定义"#t1"<"#t2", 8> c0" << endl; \
t110> c1; \
cout << " 定义"#t1"<"#t2", 10> c1" << endl; \
}
#define _DEF1(t2) { \
__DEF1(vector, t2) \
__DEF1(deque, t2) \
__DEF1(list, t2) \
__DEF1_A(array, t2) \
__DEF1(forward_list, t2) \
}
#define DEF1 { \
_DEF1(const char*) \
_DEF1(string) \
_DEF1(int) \
}
void def1() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C c" << endl;
DEF1;
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/def2.cpp
#include "../comm.h"
#define DEF2(t1, t2, c2) { \
t1<t2> c1(c2); \
cout << " 语法正确:"#t1"<"#t2"> c1("#c2")" << endl; \
}
#define DEF2_A(t1, t2, c2) { \
t1<t2, 8> c1(c2); \
cout << " 语法正确:"#t1"<"#t2", 8> c1("#c2")" << endl; \
}
#define NODEF2(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2"> c1("#c2")" << endl;
#define NODEF2_A(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2", 8> c1("#c2")" << endl;
#define OK00(c2) DEF2(vector, const char*, c2)
#define OK01(c2) DEF2(vector, string, c2)
#define OK02(c2) DEF2(vector, int, c2)
#define OK10(c2) DEF2(deque, const char*, c2)
#define OK11(c2) DEF2(deque, string, c2)
#define OK12(c2) DEF2(deque, int, c2)
#define OK20(c2) DEF2(list, const char*, c2)
#define OK21(c2) DEF2(list, string, c2)
#define OK22(c2) DEF2(list, int, c2)
#define OK30(c2) DEF2_A(array, const char*, c2)
#define OK31(c2) DEF2_A(array, string, c2)
#define OK32(c2) DEF2_A(array, int, c2)
#define OK40(c2) DEF2(forward_list, const char*, c2)
#define OK41(c2) DEF2(forward_list, string, c2)
#define OK42(c2) DEF2(forward_list, int, c2)
#define NO00(c2) NODEF2(vector, const char*, c2)
#define NO01(c2) NODEF2(vector, string, c2)
#define NO02(c2) NODEF2(vector, int, c2)
#define NO10(c2) NODEF2(deque, const char*, c2)
#define NO11(c2) NODEF2(deque, string, c2)
#define NO12(c2) NODEF2(deque, int, c2)
#define NO20(c2) NODEF2(list, const char*, c2)
#define NO21(c2) NODEF2(list, string, c2)
#define NO22(c2) NODEF2(list, int, c2)
#define NO30(c2) NODEF2_A(array, const char*, c2)
#define NO31(c2) NODEF2_A(array, string, c2)
#define NO32(c2) NODEF2_A(array, int, c2)
#define NO40(c2) NODEF2(forward_list, const char*, c2)
#define NO41(c2) NODEF2(forward_list, string, c2)
#define NO42(c2) NODEF2(forward_list, int, c2)
void def2() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C c1(c2)" << endl;
ALL;
/*vec_cp */OK00(vec_cp) NO00(vec_str) NO00(vec_int)
/*vec_str */NO01(vec_cp) OK01(vec_str) NO01(vec_int)
/*vec_int */NO02(vec_cp) NO02(vec_str) OK02(vec_int)
/*deq_cp */OK10(deq_cp) NO10(deq_str) NO10(deq_int)
/*deq_str */NO11(deq_cp) OK11(deq_str) NO11(deq_int)
/*deq_int */NO12(deq_cp) NO12(deq_str) OK12(deq_int)
/*list_cp */OK20(list_cp) NO20(list_str) NO20(list_int)
/*list_str*/NO21(list_cp) OK21(list_str) NO21(list_int)
/*list_int*/NO22(list_cp) NO22(list_str) OK22(list_int)
/*ary_cp */OK30(ary_cp) NO30(ary_str) NO30(ary_int)
/*ary_str */NO31(ary_cp) OK31(ary_str) NO31(ary_int)
/*ary_int */NO32(ary_cp) NO32(ary_str) OK32(ary_int)
/*fl_cp */OK40(fl_cp) NO40(fl_str) NO40(fl_int)
/*fl_str */NO41(fl_cp) OK41(fl_str) NO41(fl_int)
/*fl_int */NO42(fl_cp) NO42(fl_str) OK42(fl_int)
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/def3.cpp
#include "../comm.h"
#define cp_list "cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"
#define int_list 00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777
#define DEF3(t1, t2, args...) \
{ \
t1<t2> c1{args}; \
cout << " 语法正确:"#t1"<"#t2"> c1{"#args"}" << endl; \
}
#define DEF3_A(t1, t2, args...) \
{ \
t1<t2, 8> c0{args}; \
cout << " 语法正确:"#t1"<"#t2", 8> c0{"#args"}" << endl; \
t1<t2, 10> c1{args}; \
cout << " 语法正确:"#t1"<"#t2", 10> c1{"#args"}" << endl; \
}
#define NODEF3(t1, t2, args...) cout << " 语法错误:"#t1"<"#t2"> c1{"#args"}" << endl;
#define NODEF3_A(t1, t2, args...) cout << " 语法错误:"#t1"<"#t2", 8> c1{"#args"}" << endl;
#define OK00(args...) DEF3(vector, const char*, args)
#define OK01(args...) DEF3(vector, string, args)
#define OK02(args...) DEF3(vector, int, args)
#define OK10(args...) DEF3(deque, const char*, args)
#define OK11(args...) DEF3(deque, string, args)
#define OK12(args...) DEF3(deque, int, args)
#define OK20(args...) DEF3(list, const char*, args)
#define OK21(args...) DEF3(list, string, args)
#define OK22(args...) DEF3(list, int, args)
#define OK30(args...) DEF3_A(array, const char*, args)
#define OK31(args...) DEF3_A(array, string, args)
#define OK32(args...) DEF3_A(array, int, args)
#define OK40(args...) DEF3(forward_list, const char*, args)
#define OK41(args...) DEF3(forward_list, string, args)
#define OK42(args...) DEF3(forward_list, int, args)
#define NO00(args...) NODEF3(vector, const char*, args)
#define NO01(args...) NODEF3(vector, string, args)
#define NO02(args...) NODEF3(vector, int, args)
#define NO10(args...) NODEF3(deque, const char*, args)
#define NO11(args...) NODEF3(deque, string, args)
#define NO12(args...) NODEF3(deque, int, args)
#define NO20(args...) NODEF3(list, const char*, args)
#define NO21(args...) NODEF3(list, string, args)
#define NO22(args...) NODEF3(list, int, args)
#define NO30(args...) NODEF3_A(array, const char*, args)
#define NO31(args...) NODEF3_A(array, string, args)
#define NO32(args...) NODEF3_A(array, int, args)
#define NO40(args...) NODEF3(forward_list, const char*, args)
#define NO41(args...) NODEF3(forward_list, string, args)
#define NO42(args...) NODEF3(forward_list, int, args)
void def3() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C c1{a,b,c...}" << endl;
/*vec_cp */OK00(cp_list) NO00(int_list)
/*vec_str */OK00(cp_list) NO01(int_list)
/*vec_int */NO02(cp_list) OK02(int_list)
/*deq_cp */OK10(cp_list) NO10(int_list)
/*deq_str */OK11(cp_list) NO11(int_list)
/*deq_int */NO12(cp_list) OK12(int_list)
/*list_cp */OK20(cp_list) NO20(int_list)
/*list_str*/OK21(cp_list) NO21(int_list)
/*list_int*/NO22(cp_list) OK22(int_list)
/*ary_cp */OK30(cp_list) NO30(int_list)
/*ary_str */OK31(cp_list) NO31(int_list)
/*ary_int */NO32(cp_list) OK32(int_list)
/*fl_cp */OK40(cp_list) NO40(int_list)
/*fl_str */OK41(cp_list) NO41(int_list)
/*fl_int */NO42(cp_list) OK42(int_list)
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/def4.cpp
#include "../comm.h"
#define cp_list "cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"
#define int_list 00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777
#define DEF4(t1, t2, args...) \
{ \
t1<t2> c1={args}; \
cout << " 语法正确:"#t1"<"#t2"> c1={"#args"}" << endl; \
}
#define DEF4_A(t1, t2, args...) \
{ \
t1<t2, 8> c0={args}; \
cout << " 语法正确:"#t1"<"#t2", 8> c0={"#args"}" << endl; \
t1<t2, 10> c1={args}; \
cout << " 语法正确:"#t1"<"#t2", 10> c1={"#args"}" << endl; \
}
#define NODEF4(t1, t2, args...) cout << " 语法错误:"#t1"<"#t2"> c1={"#args"}" << endl;
#define NODEF4_A(t1, t2, args...) cout << " 语法错误:"#t1"<"#t2", 8> c1={"#args"}" << endl;
#define OK00(args...) DEF4(vector, const char*, args)
#define OK01(args...) DEF4(vector, string, args)
#define OK02(args...) DEF4(vector, int, args)
#define OK10(args...) DEF4(deque, const char*, args)
#define OK11(args...) DEF4(deque, string, args)
#define OK12(args...) DEF4(deque, int, args)
#define OK20(args...) DEF4(list, const char*, args)
#define OK21(args...) DEF4(list, string, args)
#define OK22(args...) DEF4(list, int, args)
#define OK30(args...) DEF4_A(array, const char*, args)
#define OK31(args...) DEF4_A(array, string, args)
#define OK32(args...) DEF4_A(array, int, args)
#define OK40(args...) DEF4(forward_list, const char*, args)
#define OK41(args...) DEF4(forward_list, string, args)
#define OK42(args...) DEF4(forward_list, int, args)
#define NO00(args...) NODEF4(vector, const char*, args)
#define NO01(args...) NODEF4(vector, string, args)
#define NO02(args...) NODEF4(vector, int, args)
#define NO10(args...) NODEF4(deque, const char*, args)
#define NO11(args...) NODEF4(deque, string, args)
#define NO12(args...) NODEF4(deque, int, args)
#define NO20(args...) NODEF4(list, const char*, args)
#define NO21(args...) NODEF4(list, string, args)
#define NO22(args...) NODEF4(list, int, args)
#define NO30(args...) NODEF4_A(array, const char*, args)
#define NO31(args...) NODEF4_A(array, string, args)
#define NO32(args...) NODEF4_A(array, int, args)
#define NO40(args...) NODEF4(forward_list, const char*, args)
#define NO41(args...) NODEF4(forward_list, string, args)
#define NO42(args...) NODEF4(forward_list, int, args)
void def4() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C c1={a,b,c...}" << endl;
/*vec_cp */OK00(cp_list) NO00(int_list)
/*vec_str */OK00(cp_list) NO01(int_list)
/*vec_int */NO02(cp_list) OK02(int_list)
/*deq_cp */OK10(cp_list) NO10(int_list)
/*deq_str */OK11(cp_list) NO11(int_list)
/*deq_int */NO12(cp_list) OK12(int_list)
/*list_cp */OK20(cp_list) NO20(int_list)
/*list_str*/OK21(cp_list) NO21(int_list)
/*list_int*/NO22(cp_list) OK22(int_list)
/*ary_cp */OK30(cp_list) NO30(int_list)
/*ary_str */OK31(cp_list) NO31(int_list)
/*ary_int */NO32(cp_list) OK32(int_list)
/*fl_cp */OK40(cp_list) NO40(int_list)
/*fl_str */OK41(cp_list) NO41(int_list)
/*fl_int */NO42(cp_list) OK42(int_list)
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/def5.cpp
#include "../comm.h"
#define DEF5(t1, t2, c2) { \
t1<t2> c1(c2.begin(), c2.end()); \
cout << " 语法正确:"#t1"<"#t2"> c1("#c2".begin(),"#c2".end())" << endl; \
}
#define NODEF5(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2"> c1("#c2".begin(),"#c2".end())" << endl;
#define NODEF5_A(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2", 8> c1("#c2".begin(),"#c2".end())" << endl;
#define OK00(c2) DEF5(vector, const char*, c2)
#define OK01(c2) DEF5(vector, string, c2)
#define OK02(c2) DEF5(vector, int, c2)
#define OK10(c2) DEF5(deque, const char*, c2)
#define OK11(c2) DEF5(deque, string, c2)
#define OK12(c2) DEF5(deque, int, c2)
#define OK20(c2) DEF5(list, const char*, c2)
#define OK21(c2) DEF5(list, string, c2)
#define OK22(c2) DEF5(list, int, c2)
#define OK30(c2)
#define OK31(c2)
#define OK32(c2)
#define OK40(c2) DEF5(forward_list, const char*, c2)
#define OK41(c2) DEF5(forward_list, string, c2)
#define OK42(c2) DEF5(forward_list, int, c2)
#define NO00(c2) NODEF5(vector, const char*, c2)
#define NO01(c2) NODEF5(vector, string, c2)
#define NO02(c2) NODEF5(vector, int, c2)
#define NO10(c2) NODEF5(deque, const char*, c2)
#define NO11(c2) NODEF5(deque, string, c2)
#define NO12(c2) NODEF5(deque, int, c2)
#define NO20(c2) NODEF5(list, const char*, c2)
#define NO21(c2) NODEF5(list, string, c2)
#define NO22(c2) NODEF5(list, int, c2)
#define NO30(c2) NODEF5_A(array, const char*, c2)
#define NO31(c2) NODEF5_A(array, string, c2)
#define NO32(c2) NODEF5_A(array, int, c2)
#define NO40(c2) NODEF5(forward_list, const char*, c2)
#define NO41(c2) NODEF5(forward_list, string, c2)
#define NO42(c2) NODEF5(forward_list, int, c2)
void def5() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C c1{b,e}" << endl;
ALL;
/*vec_cp */OK00(vec_cp) NO00(vec_str) NO00(vec_int) OK00(deq_cp) NO00(deq_str) NO00(deq_int) OK00(list_cp) NO00(list_str) NO00(list_int) OK00(ary_cp) NO00(ary_str) NO00(ary_int) OK00(fl_cp) NO00(fl_str) NO00(fl_int) cout << endl;
/*vec_str */OK01(vec_cp) OK01(vec_str) NO01(vec_int) OK01(deq_cp) OK01(deq_str) NO01(deq_int) OK01(list_cp) OK01(list_str) NO01(list_int) OK01(ary_cp) OK01(ary_str) NO01(ary_int) OK01(fl_cp) OK01(fl_str) NO01(fl_int) cout << endl;
/*vec_int */NO02(vec_cp) NO02(vec_str) OK02(vec_int) NO02(deq_cp) NO02(deq_str) OK02(deq_int) NO02(list_cp) NO02(list_str) OK02(list_int) NO02(ary_cp) NO02(ary_str) OK02(ary_int) NO02(fl_cp) NO02(fl_str) OK02(fl_int) cout << endl;
/*deq_cp */OK10(vec_cp) NO10(vec_str) NO10(vec_int) OK10(deq_cp) NO10(deq_str) NO10(deq_int) OK10(list_cp) NO10(list_str) NO10(list_int) OK10(ary_cp) NO10(ary_str) NO10(ary_int) OK10(fl_cp) NO10(fl_str) NO10(fl_int) cout << endl;
/*deq_str */OK11(vec_cp) OK11(vec_str) NO11(vec_int) OK11(deq_cp) OK11(deq_str) NO11(deq_int) OK11(list_cp) OK11(list_str) NO11(list_int) OK11(ary_cp) OK11(ary_str) NO11(ary_int) OK11(fl_cp) OK11(fl_str) NO11(fl_int) cout << endl;
/*deq_int */NO12(vec_cp) NO12(vec_str) OK12(vec_int) NO12(deq_cp) NO12(deq_str) OK12(deq_int) NO12(list_cp) NO12(list_str) OK12(list_int) NO12(ary_cp) NO12(ary_str) OK12(ary_int) NO12(fl_cp) NO12(fl_str) OK12(fl_int) cout << endl;
/*list_cp */OK20(vec_cp) NO20(vec_str) NO20(vec_int) OK20(deq_cp) NO20(deq_str) NO20(deq_int) OK20(list_cp) NO20(list_str) NO20(list_int) OK20(ary_cp) NO20(ary_str) NO20(ary_int) OK20(fl_cp) NO20(fl_str) NO20(fl_int) cout << endl;
/*list_str*/OK21(vec_cp) OK21(vec_str) NO21(vec_int) OK21(deq_cp) OK21(deq_str) NO21(deq_int) OK21(list_cp) OK21(list_str) NO21(list_int) OK21(ary_cp) OK21(ary_str) NO21(ary_int) OK21(fl_cp) OK21(fl_str) NO21(fl_int) cout << endl;
/*list_int*/NO22(vec_cp) NO22(vec_str) OK22(vec_int) NO22(deq_cp) NO22(deq_str) OK22(deq_int) NO22(list_cp) NO22(list_str) OK22(list_int) NO22(ary_cp) NO22(ary_str) OK22(ary_int) NO22(fl_cp) NO22(fl_str) OK22(fl_int) cout << endl;
/*ary_cp */NO30(vec_cp) NO30(vec_str) NO30(vec_int) NO30(deq_cp) NO30(deq_str) NO30(deq_int) NO30(list_cp) NO30(list_str) NO30(list_int) NO30(ary_cp) NO30(ary_str) NO30(ary_int) NO30(fl_cp) NO30(fl_str) NO30(fl_int) cout << endl;
/*ary_str */NO31(vec_cp) NO31(vec_str) NO31(vec_int) NO31(deq_cp) NO31(deq_str) NO31(deq_int) NO31(list_cp) NO31(list_str) NO31(list_int) NO31(ary_cp) NO31(ary_str) NO31(ary_int) NO31(fl_cp) NO31(fl_str) NO31(fl_int) cout << endl;
/*ary_int */NO32(vec_cp) NO32(vec_str) NO32(vec_int) NO32(deq_cp) NO32(deq_str) NO32(deq_int) NO32(list_cp) NO32(list_str) NO32(list_int) NO32(ary_cp) NO32(ary_str) NO32(ary_int) NO32(fl_cp) NO32(fl_str) NO32(fl_int) cout << endl;
/*fl_cp */OK40(vec_cp) NO40(vec_str) NO40(vec_int) OK40(deq_cp) NO40(deq_str) NO40(deq_int) OK40(list_cp) NO40(list_str) NO40(list_int) OK40(ary_cp) NO40(ary_str) NO40(ary_int) OK40(fl_cp) NO40(fl_str) NO40(fl_int) cout << endl;
/*fl_str */OK41(vec_cp) OK41(vec_str) NO41(vec_int) OK41(deq_cp) OK41(deq_str) NO41(deq_int) OK41(list_cp) OK41(list_str) NO41(list_int) OK41(ary_cp) OK41(ary_str) NO41(ary_int) OK41(fl_cp) OK41(fl_str) NO41(fl_int) cout << endl;
/*fl_int */NO42(vec_cp) NO42(vec_str) OK42(vec_int) NO42(deq_cp) NO42(deq_str) OK42(deq_int) NO42(list_cp) NO42(list_str) OK42(list_int) NO42(ary_cp) NO42(ary_str) OK42(ary_int) NO42(fl_cp) NO42(fl_str) OK42(fl_int) cout << endl;
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/def6.cpp
#include "../comm.h"
#define __DEF6(t1, t2) { \
t1 seq(8); \
cout << " 定义"#t1"<"#t2"> seq(8)" << endl; \
}
#define __DEF6_A(t1, t2){ \
t18> seq0; \
cout << " 定义"#t1"<"#t2", 8> seq0" << endl; \
t110> seq1; \
cout << " 定义"#t1"<"#t2", 10> seq1" << endl; \
}
#define _DEF6(t2) { \
__DEF6(vector, t2) \
__DEF6(deque, t2) \
__DEF6(list, t2) \
__DEF6_A(array, t2) \
__DEF6(forward_list, t2) \
}
#define DEF6 { \
_DEF6(const char*) \
_DEF6(string) \
_DEF6(int) \
}
void def6() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C seq(n)" << endl;
DEF6;
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/def7.cpp
#include "../comm.h"
#define _DEF7(t1, t2, n, t) { \
t1 c1(n, t); \
cout << " 语法正确:"#t1"<"#t2"> c1("#n","#t")" << endl; \
}
#define _DEF7_A(t1, t2, n, t) { \
cout << " 语法错误:"#t1"<"#t2", 8> c1("#n","#t")" << endl; \
}
#define DEF7 _DEF7(vector, const char*, 8, "str") \
_DEF7(vector, string, 8, "str") \
_DEF7(vector, int, 8, 12345) \
_DEF7(deque, const char*, 8, "str") \
_DEF7(deque, string, 8, "str") \
_DEF7(deque, int, 8, 12345) \
_DEF7(list, const char*, 8, "str") \
_DEF7(list, string, 8, "str") \
_DEF7(list, int, 8, 12345) \
_DEF7_A(array, const char*, 8, "str") \
_DEF7_A(array, string, 8, "str") \
_DEF7_A(array, int, 8, 12345) \
_DEF7(forward_list, const char*, 8, "str") \
_DEF7(forward_list, string, 8, "str") \
_DEF7(forward_list, int, 8, 12345)
void def7() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " C seq(n)" << endl;
DEF7;
cout << " --------------------------------------------------------------"
<< endl;
}
def_and_init/test.cpp
#include
using namespace std;
void def_and_init() {
//C c
cout << "***********************def_and_init start*************************"
<< endl;
extern void def1();
def1();
extern void def2();
def2();
extern void def3();
def3();
extern void def4();
def4();
extern void def5();
def5();
extern void def6();
def6();
extern void def7();
def7();
cout << "***********************def_and_init end***************************"
<< endl;
}
assign_and_swap/assign1.cpp
#include "../comm.h"
#define ASN1(t1, t2, c2) { t1<t2> c1; \
c1 = c2; \
cout << " 语法正确:"#t1"<"#t2"> c1="#c2 << endl; \
}
#define ASN1_A(t1, t2, c2) { t1<t2, 8> c1; \
c1 = c2; \
cout << " 语法正确:"#t1"<"#t2", 8> c1="#c2 << endl; \
}
#define NOASN1(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2"> c1="#c2 << endl;
#define NOASN1_A(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2", 8> c1="#c2 << endl;
#define OK00(c2) ASN1(vector, const char*, c2)
#define OK01(c2) ASN1(vector, string, c2)
#define OK02(c2) ASN1(vector, int, c2)
#define OK10(c2) ASN1(deque, const char*, c2)
#define OK11(c2) ASN1(deque, string, c2)
#define OK12(c2) ASN1(deque, int, c2)
#define OK20(c2) ASN1(list, const char*, c2)
#define OK21(c2) ASN1(list, string, c2)
#define OK22(c2) ASN1(list, int, c2)
#define OK30(c2) ASN1_A(array, const char*, c2)
#define OK31(c2) ASN1_A(array, string, c2)
#define OK32(c2) ASN1_A(array, int, c2)
#define OK40(c2) ASN1(forward_list, const char*, c2)
#define OK41(c2) ASN1(forward_list, string, c2)
#define OK42(c2) ASN1(forward_list, int, c2)
#define NO00(c2) NOASN1(vector, const char*, c2)
#define NO01(c2) NOASN1(vector, string, c2)
#define NO02(c2) NOASN1(vector, int, c2)
#define NO10(c2) NOASN1(deque, const char*, c2)
#define NO11(c2) NOASN1(deque, string, c2)
#define NO12(c2) NOASN1(deque, int, c2)
#define NO20(c2) NOASN1(list, const char*, c2)
#define NO21(c2) NOASN1(list, string, c2)
#define NO22(c2) NOASN1(list, int, c2)
#define NO30(c2) NOASN1_A(array, const char*, c2)
#define NO31(c2) NOASN1_A(array, string, c2)
#define NO32(c2) NOASN1_A(array, int, c2)
#define NO40(c2) NOASN1(forward_list, const char*, c2)
#define NO41(c2) NOASN1(forward_list, string, c2)
#define NO42(c2) NOASN1(forward_list, int, c2)
void assign1() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " c1=c2" << endl;
ALL;
/*vec_cp */OK00(vec_cp) NO00(vec_str) NO00(vec_int)
/*vec_str */NO01(vec_cp) OK01(vec_str) NO01(vec_int)
/*vec_int */NO02(vec_cp) NO02(vec_str) OK02(vec_int)
/*deq_cp */OK10(deq_cp) NO10(deq_str) NO10(deq_int)
/*deq_str */NO11(deq_cp) OK11(deq_str) NO11(deq_int)
/*deq_int */NO12(deq_cp) NO12(deq_str) OK12(deq_int)
/*list_cp */OK20(list_cp) NO20(list_str) NO20(list_int)
/*list_str*/NO21(list_cp) OK21(list_str) NO21(list_int)
/*list_int*/NO22(list_cp) NO22(list_str) OK22(list_int)
/*ary_cp */OK30(ary_cp) NO30(ary_str) NO30(ary_int)
/*ary_str */NO31(ary_cp) OK31(ary_str) NO31(ary_int)
/*ary_int */NO32(ary_cp) NO32(ary_str) OK32(ary_int)
/*fl_cp */OK40(fl_cp) NO40(fl_str) NO40(fl_int)
/*fl_str */NO41(fl_cp) OK41(fl_str) NO41(fl_int)
/*fl_int */NO42(fl_cp) NO42(fl_str) OK42(fl_int)
cout << " --------------------------------------------------------------"
<< endl;
}
assign_and_swap/assign2.cpp
#include "../comm.h"
#define ASN2(t1, t2, c2) { \
t1<t2> c1; \
c1.assign(c2.begin(), c2.end()); \
cout << " 语法正确:"#t1"<"#t2"> c1.assign("#c2".begin(),"#c2".end())" << endl; \
}
#define NOASN2(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2"> c1.assign("#c2".begin(),"#c2".end())" << endl;
#define NOASN2_A(t1, t2, c2) cout << " 语法错误:"#t1"<"#t2", 8> c1.assign("#c2".begin(),"#c2".end())" << endl;
#define OK00(c2) ASN2(vector, const char*, c2)
#define OK01(c2) ASN2(vector, string, c2)
#define OK02(c2) ASN2(vector, int, c2)
#define OK10(c2) ASN2(deque, const char*, c2)
#define OK11(c2) ASN2(deque, string, c2)
#define OK12(c2) ASN2(deque, int, c2)
#define OK20(c2) ASN2(list, const char*, c2)
#define OK21(c2) ASN2(list, string, c2)
#define OK22(c2) ASN2(list, int, c2)
#define OK30(c2)
#define OK31(c2)
#define OK32(c2)
#define OK40(c2) ASN2(forward_list, const char*, c2)
#define OK41(c2) ASN2(forward_list, string, c2)
#define OK42(c2) ASN2(forward_list, int, c2)
#define NO00(c2) NOASN2(vector, const char*, c2)
#define NO01(c2) NOASN2(vector, string, c2)
#define NO02(c2) NOASN2(vector, int, c2)
#define NO10(c2) NOASN2(deque, const char*, c2)
#define NO11(c2) NOASN2(deque, string, c2)
#define NO12(c2) NOASN2(deque, int, c2)
#define NO20(c2) NOASN2(list, const char*, c2)
#define NO21(c2) NOASN2(list, string, c2)
#define NO22(c2) NOASN2(list, int, c2)
#define NO30(c2) NOASN2_A(array, const char*, c2)
#define NO31(c2) NOASN2_A(array, string, c2)
#define NO32(c2) NOASN2_A(array, int, c2)
#define NO40(c2) NOASN2(forward_list, const char*, c2)
#define NO41(c2) NOASN2(forward_list, string, c2)
#define NO42(c2) NOASN2(forward_list, int, c2)
void assign2() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " c1.assign(b,e)" << endl;
ALL;
/*vec_cp */OK00(vec_cp) NO00(vec_str) NO00(vec_int) OK00(deq_cp) NO00(deq_str) NO00(deq_int) OK00(list_cp) NO00(list_str) NO00(list_int) OK00(ary_cp) NO00(ary_str) NO00(ary_int) OK00(fl_cp) NO00(fl_str) NO00(fl_int) cout << endl;
/*vec_str */OK01(vec_cp) OK01(vec_str) NO01(vec_int) OK01(deq_cp) OK01(deq_str) NO01(deq_int) OK01(list_cp) OK01(list_str) NO01(list_int) OK01(ary_cp) OK01(ary_str) NO01(ary_int) OK01(fl_cp) OK01(fl_str) NO01(fl_int) cout << endl;
/*vec_int */NO02(vec_cp) NO02(vec_str) OK02(vec_int) NO02(deq_cp) NO02(deq_str) OK02(deq_int) NO02(list_cp) NO02(list_str) OK02(list_int) NO02(ary_cp) NO02(ary_str) OK02(ary_int) NO02(fl_cp) NO02(fl_str) OK02(fl_int) cout << endl;
/*deq_cp */OK10(vec_cp) NO10(vec_str) NO10(vec_int) OK10(deq_cp) NO10(deq_str) NO10(deq_int) OK10(list_cp) NO10(list_str) NO10(list_int) OK10(ary_cp) NO10(ary_str) NO10(ary_int) OK10(fl_cp) NO10(fl_str) NO10(fl_int) cout << endl;
/*deq_str */OK11(vec_cp) OK11(vec_str) NO11(vec_int) OK11(deq_cp) OK11(deq_str) NO11(deq_int) OK11(list_cp) OK11(list_str) NO11(list_int) OK11(ary_cp) OK11(ary_str) NO11(ary_int) OK11(fl_cp) OK11(fl_str) NO11(fl_int) cout << endl;
/*deq_int */NO12(vec_cp) NO12(vec_str) OK12(vec_int) NO12(deq_cp) NO12(deq_str) OK12(deq_int) NO12(list_cp) NO12(list_str) OK12(list_int) NO12(ary_cp) NO12(ary_str) OK12(ary_int) NO12(fl_cp) NO12(fl_str) OK12(fl_int) cout << endl;
/*list_cp */OK20(vec_cp) NO20(vec_str) NO20(vec_int) OK20(deq_cp) NO20(deq_str) NO20(deq_int) OK20(list_cp) NO20(list_str) NO20(list_int) OK20(ary_cp) NO20(ary_str) NO20(ary_int) OK20(fl_cp) NO20(fl_str) NO20(fl_int) cout << endl;
/*list_str*/OK21(vec_cp) OK21(vec_str) NO21(vec_int) OK21(deq_cp) OK21(deq_str) NO21(deq_int) OK21(list_cp) OK21(list_str) NO21(list_int) OK21(ary_cp) OK21(ary_str) NO21(ary_int) OK21(fl_cp) OK21(fl_str) NO21(fl_int) cout << endl;
/*list_int*/NO22(vec_cp) NO22(vec_str) OK22(vec_int) NO22(deq_cp) NO22(deq_str) OK22(deq_int) NO22(list_cp) NO22(list_str) OK22(list_int) NO22(ary_cp) NO22(ary_str) OK22(ary_int) NO22(fl_cp) NO22(fl_str) OK22(fl_int) cout << endl;
/*ary_cp */NO30(vec_cp) NO30(vec_str) NO30(vec_int) NO30(deq_cp) NO30(deq_str) NO30(deq_int) NO30(list_cp) NO30(list_str) NO30(list_int) NO30(ary_cp) NO30(ary_str) NO30(ary_int) NO30(fl_cp) NO30(fl_str) NO30(fl_int) cout << endl;
/*ary_str */NO31(vec_cp) NO31(vec_str) NO31(vec_int) NO31(deq_cp) NO31(deq_str) NO31(deq_int) NO31(list_cp) NO31(list_str) NO31(list_int) NO31(ary_cp) NO31(ary_str) NO31(ary_int) NO31(fl_cp) NO31(fl_str) NO31(fl_int) cout << endl;
/*ary_int */NO32(vec_cp) NO32(vec_str) NO32(vec_int) NO32(deq_cp) NO32(deq_str) NO32(deq_int) NO32(list_cp) NO32(list_str) NO32(list_int) NO32(ary_cp) NO32(ary_str) NO32(ary_int) NO32(fl_cp) NO32(fl_str) NO32(fl_int) cout << endl;
/*fl_cp */OK40(vec_cp) NO40(vec_str) NO40(vec_int) OK40(deq_cp) NO40(deq_str) NO40(deq_int) OK40(list_cp) NO40(list_str) NO40(list_int) OK40(ary_cp) NO40(ary_str) NO40(ary_int) OK40(fl_cp) NO40(fl_str) NO40(fl_int) cout << endl;
/*fl_str */OK41(vec_cp) OK41(vec_str) NO41(vec_int) OK41(deq_cp) OK41(deq_str) NO41(deq_int) OK41(list_cp) OK41(list_str) NO41(list_int) OK41(ary_cp) OK41(ary_str) NO41(ary_int) OK41(fl_cp) OK41(fl_str) NO41(fl_int) cout << endl;
/*fl_int */NO42(vec_cp) NO42(vec_str) OK42(vec_int) NO42(deq_cp) NO42(deq_str) OK42(deq_int) NO42(list_cp) NO42(list_str) OK42(list_int) NO42(ary_cp) NO42(ary_str) OK42(ary_int) NO42(fl_cp) NO42(fl_str) OK42(fl_int) cout << endl;
cout << " --------------------------------------------------------------"
<< endl;
}
assign_and_swap/assign3.cpp
#include "../comm.h"
#define cp_list "cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"
#define int_list 00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777
#define ASN3(t1, t2, args...) \
{ \
t1<t2> c1; \
c1={args}; \
c1.assign({args}); \
cout << " "#t1"<"#t2">" << endl; \
cout << " 语法正确:c1={"#args"}" << endl; \
cout << " 语法正确:c1.assign({"#args"})" << endl; \
}
#define ASN3_A(t1, t2, args...)
#define NOASN3(t1, t2, args...) cout << " "#t1"<"#t2">" << endl; \
cout << " 语法错误:c1={"#args"}" << endl; \
cout << " 语法错误:c1.assign({"#args"})" << endl; \
#define NOASN3_A(t1, t2, args...) cout << " "#t1"<"#t2">" << endl; \
cout << " 语法错误:c1={"#args"}" << endl; \
cout << " 语法错误:c1.assign({"#args"})" << endl; \
#define OK00(args...) ASN3(vector, const char*, args)
#define OK01(args...) ASN3(vector, string, args)
#define OK02(args...) ASN3(vector, int, args)
#define OK10(args...) ASN3(deque, const char*, args)
#define OK11(args...) ASN3(deque, string, args)
#define OK12(args...) ASN3(deque, int, args)
#define OK20(args...) ASN3(list, const char*, args)
#define OK21(args...) ASN3(list, string, args)
#define OK22(args...) ASN3(list, int, args)
#define OK30(args...) ASN3_A(array, const char*, args)
#define OK31(args...) ASN3_A(array, string, args)
#define OK32(args...) ASN3_A(array, int, args)
#define OK40(args...) ASN3(forward_list, const char*, args)
#define OK41(args...) ASN3(forward_list, string, args)
#define OK42(args...) ASN3(forward_list, int, args)
#define NO00(args...) NOASN3(vector, const char*, args)
#define NO01(args...) NOASN3(vector, string, args)
#define NO02(args...) NOASN3(vector, int, args)
#define NO10(args...) NOASN3(deque, const char*, args)
#define NO11(args...) NOASN3(deque, string, args)
#define NO12(args...) NOASN3(deque, int, args)
#define NO20(args...) NOASN3(list, const char*, args)
#define NO21(args...) NOASN3(list, string, args)
#define NO22(args...) NOASN3(list, int, args)
#define NO30(args...) NOASN3_A(array, const char*, args)
#define NO31(args...) NOASN3_A(array, string, args)
#define NO32(args...) NOASN3_A(array, int, args)
#define NO40(args...) NOASN3(forward_list, const char*, args)
#define NO41(args...) NOASN3(forward_list, string, args)
#define NO42(args...) NOASN3(forward_list, int, args)
void assign3() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " c1 assign il" << endl;
/*vec_cp */OK00(cp_list) NO00(int_list)
/*vec_str */OK01(cp_list) NO01(int_list)
/*vec_int */NO02(cp_list) OK02(int_list)
/*deq_cp */OK10(cp_list) NO10(int_list)
/*deq_str */OK11(cp_list) NO11(int_list)
/*deq_int */NO12(cp_list) OK12(int_list)
/*list_cp */OK20(cp_list) NO20(int_list)
/*list_str*/OK21(cp_list) NO21(int_list)
/*list_int*/NO22(cp_list) OK22(int_list)
/*ary_cp */NO30(cp_list) NO30(int_list)
/*ary_str */NO31(cp_list) NO31(int_list)
/*ary_int */NO32(cp_list) NO32(int_list)
/*fl_cp */OK40(cp_list) NO40(int_list)
/*fl_str */OK41(cp_list) NO41(int_list)
/*fl_int */NO42(cp_list) OK42(int_list)
cout << " --------------------------------------------------------------"
<< endl;
}
assign_and_swap/swap.cpp
#include "../comm.h"
#define SWAP(t1, t2, c2) { \
t1<t2> c1; \
swap(c1, c2); \
c1.swap(c2); \
cout << " "#t1"<"#t2"> c1" << endl; \
cout << " 语法正确:c1.swap("#c2")" << endl; \
cout << " 语法正确:swap(c1, "#c2")" << endl; \
}
#define SWAP_A(t1, t2, c2) { \
t1<t2, 8> c1(c2); \
swap(c1, c2); \
c1.swap(c2); \
cout << " "#t1"<"#t2", 8> c1" << endl; \
cout << " 语法正确:c1.swap("#c2")" << endl; \
cout << " 语法正确:swap(c1, "#c2")" << endl; \
}
#define NOSWAP(t1, t2, c2) cout << " "#t1"<"#t2"> c1" << endl; \
cout << " 语法错误:c1.swap("#c2")" << endl; \
cout << " 语法错误:swap(c1, "#c2")" << endl; \
#define NOSWAP_A(t1, t2, c2) cout << " "#t1"<"#t2", 8> c1" << endl; \
cout << " 语法错误:c1.swap("#c2")" << endl; \
cout << " 语法错误:swap(c1, "#c2")" << endl; \
#define OK00(c2) SWAP(vector, const char*, c2)
#define OK01(c2) SWAP(vector, string, c2)
#define OK02(c2) SWAP(vector, int, c2)
#define OK10(c2) SWAP(deque, const char*, c2)
#define OK11(c2) SWAP(deque, string, c2)
#define OK12(c2) SWAP(deque, int, c2)
#define OK20(c2) SWAP(list, const char*, c2)
#define OK21(c2) SWAP(list, string, c2)
#define OK22(c2) SWAP(list, int, c2)
#define OK30(c2) SWAP_A(array, const char*, c2)
#define OK31(c2) SWAP_A(array, string, c2)
#define OK32(c2) SWAP_A(array, int, c2)
#define OK40(c2) SWAP(forward_list, const char*, c2)
#define OK41(c2) SWAP(forward_list, string, c2)
#define OK42(c2) SWAP(forward_list, int, c2)
#define NO00(c2) NOSWAP(vector, const char*, c2)
#define NO01(c2) NOSWAP(vector, string, c2)
#define NO02(c2) NOSWAP(vector, int, c2)
#define NO10(c2) NOSWAP(deque, const char*, c2)
#define NO11(c2) NOSWAP(deque, string, c2)
#define NO12(c2) NOSWAP(deque, int, c2)
#define NO20(c2) NOSWAP(list, const char*, c2)
#define NO21(c2) NOSWAP(list, string, c2)
#define NO22(c2) NOSWAP(list, int, c2)
#define NO30(c2) NOSWAP_A(array, const char*, c2)
#define NO31(c2) NOSWAP_A(array, string, c2)
#define NO32(c2) NOSWAP_A(array, int, c2)
#define NO40(c2) NOSWAP(forward_list, const char*, c2)
#define NO41(c2) NOSWAP(forward_list, string, c2)
#define NO42(c2) NOSWAP(forward_list, int, c2)
void swap() {
cout << " --------------------------------------------------------------"
<< endl;
cout << " swap c1 c2" << endl;
ALL;
/*vec_cp */OK00(vec_cp) NO00(vec_str) NO00(vec_int)
/*vec_str */NO01(vec_cp) OK01(vec_str) NO01(vec_int)
/*vec_int */NO02(vec_cp) NO02(vec_str) OK02(vec_int)
/*deq_cp */OK10(deq_cp) NO10(deq_str) NO10(deq_int)
/*deq_str */NO11(deq_cp) OK11(deq_str) NO11(deq_int)
/*deq_int */NO12(deq_cp) NO12(deq_str) OK12(deq_int)
/*list_cp */OK20(list_cp) NO20(list_str) NO20(list_int)
/*list_str*/NO21(list_cp) OK21(list_str) NO21(list_int)
/*list_int*/NO22(list_cp) NO22(list_str) OK22(list_int)
/*ary_cp */OK30(ary_cp) NO30(ary_str) NO30(ary_int)
/*ary_str */NO31(ary_cp) OK31(ary_str) NO31(ary_int)
/*ary_int */NO32(ary_cp) NO32(ary_str) OK32(ary_int)
/*fl_cp */OK40(fl_cp) NO40(fl_str) NO40(fl_int)
/*fl_str */NO41(fl_cp) OK41(fl_str) NO41(fl_int)
/*fl_int */NO42(fl_cp) NO42(fl_str) OK42(fl_int)
cout << " --------------------------------------------------------------"
<< endl;
}
assign_and_swap/test.cpp
#include
using namespace std;
void assign_and_swap() {
//C c
cout << "**********************assign_and_swap start***********************"
<< endl;
extern void assign1();
assign1();
extern void assign2();
assign2();
extern void assign3();
assign3();
extern void swap();
swap();
cout << "**********************assign_and_swap end*************************"
<< endl;
}
access/test.cpp
#include "../comm.h"
#define back_f(c) { \
c.back(); \
cout << " 语法正确:"#c".back()" << endl; \
}
#define back_e(c) { \
cout << " 语法错误:"#c".back()" << endl; \
}
#define front_f(c) { \
c.front(); \
cout << " 语法正确:"#c".front()" << endl; \
}
#define front_e(c) { \
cout << " 语法错误:"#c".front()" << endl; \
}
#define at0_f(c) { \
c[4]; \
cout << " 语法正确:"#c"[4]" << endl; \
}
#define at0_e(c) { \
cout << " 语法错误:"#c"[4]" << endl; \
}
#define at_f(c) { \
c.at(4); \
cout << " 语法正确:"#c"at(4)" << endl; \
}
#define at_e(c) { \
cout << " 语法错误:"#c"at(4)" << endl; \
}
#define OK00(c) back_f(c)
#define OK01(c) front_f(c)
#define OK02(c) at0_f(c)
#define OK03(c) at_f(c)
#define NO00(c) back_e(c)
#define NO01(c) front_e(c)
#define NO02(c) at0_e(c)
#define NO03(c) at_e(c)
void access_item() {
cout << "************************access_item start*************************"
<< endl;
ALL;
/*back */OK00(vec_str) OK00(deq_str) OK00(list_str) OK00(ary_str) NO00(fl_str)
/*front*/OK01(vec_str) OK01(deq_str) OK01(list_str) OK01(ary_str) OK01(fl_str)
/*[n] */OK02(vec_str) OK02(deq_str) NO02(list_str) NO02(ary_str) NO02(fl_str)
/*at(n)*/OK03(vec_str) OK03(deq_str) NO03(list_str) NO03(ary_str) NO03(fl_str)
cout << "************************access_item end***************************"
<< endl;
}
add_item/test.cpp
#include "../comm.h"
#define push_back_f(c) { \
c.push_back(string("str")); \
cout << " 语法正确:"#c".push_back(string(\"str\"))" << endl; \
}
#define push_back_e(c) { \
cout << " 语法错误:"#c".push_back(string(\"str\"))" << endl; \
}
#define emplace_back_f(c) { \
const char *p = "01234"; \
c.emplace_back(p, 3); \
cout << " 语法正确:"#c".c.emplace_back(\"01234\", 3)" << endl; \
}
#define emplace_back_e(c){ \
cout << " 语法错误:"#c".c.emplace_back(\"01234\", 3)" << endl; \
}
#define push_front_f(c) { \
c.push_front(string("str")); \
cout << " 语法正确:"#c".push_front(string(\"str\"))" << endl; \
}
#define push_front_e(c) { \
cout << " 语法错误:"#c".push_front(string(\"str\"))" << endl; \
}
#define emplace_front_f(c){ \
c.emplace_front("01234", 3); \
cout << " 语法正确:"#c".c.emplace_front(\"01234\", 3)" << endl; \
}
#define emplace_front_e(c){ \
cout << " 语法错误:"#c".c.emplace_front(\"01234\", 3)" << endl; \
}
#define insert_f(c) { \
c.insert(c.begin(), string("str")); \
cout << " 语法正确:"#c".insert(p, string(\"str\"))" << endl; \
}
#define insert_e(c) { \
cout << " 语法错误:"#c".insert(p, string(\"str\"))" << endl; \
}
#define emplace_f(c) { \
c.emplace(c.begin(), "01234", 3); \
cout << " 语法正确:"#c".c.emplace(p, \"01234\", 3)" << endl; \
}
#define emplace_e(c) { \
cout << " 语法错误:"#c".c.emplace(p, \"01234\", 3)" << endl; \
}
#define insert_f2(c) { \
c.insert(c.begin(), 2, string("str")); \
cout << " 语法正确:"#c".insert(p, 2, string(\"str\"))" << endl; \
}
#define insert_e2(c) { \
cout << " 语法错误:"#c".insert(p, 2, string(\"str\"))" << endl; \
}
#define insert_f3(c) { \
auto tmp = c; \
c.insert(c.begin(), tmp.begin(), tmp.end()); \
cout << " 语法正确:"#c".insert(p, tmp.begin(), tmp.end())" << endl; \
}
#define insert_e3(c) { \
cout << " 语法错误:"#c".insert(p, tmp.begin(), tmp.end())" << endl; \
}
#define cp_list "cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"
#define insert_f4(c, args...){ \
c.insert(c.begin(), {args}); \
cout << " 语法正确:"#c".insert(p, {"#args"})" << endl; \
}
#define insert_e4(c, args...){ \
cout << " 语法错误:"#c".insert(p, {"#args"})" << endl; \
}
#define OK00(c) push_back_f(c)
#define OK01(c) emplace_back_f(c)
#define OK02(c) push_front_f(c)
#define OK03(c) emplace_front_f(c)
#define OK04(c) insert_f(c)
#define OK05(c) emplace_f(c)
#define OK06(c) insert_f2(c)
#define OK07(c) insert_f3(c)
#define OK08(c) insert_f4(c,cp_list)
#define NO00(c) push_back_e
#define NO01(c) emplace_back_e(c)
#define NO02(c) push_front_e(c)
#define NO03(c) emplace_front_e(c)
#define NO04(c) insert_e(c)
#define NO05(c) emplace_e(c)
#define NO06(c) insert_e2(c)
#define NO07(c) insert_e3(c)
#define NO08(c) insert_e4(c,cp_list)
void add_item() {
//C c
cout << "**************************add_item start**************************"
<< endl;
ALL;
/*push_back */OK00(vec_str) OK00(deq_str) OK00(list_str)
/*emplace_back */OK01(vec_str) OK01(deq_str) OK01(list_str)
/*push_front */NO02(vec_str) OK02(deq_str) OK02(list_str)
/*emplace_front */NO03(vec_str) OK03(deq_str) OK03(list_str)
/*insert(p,t) */OK04(vec_str) OK04(deq_str) OK04(list_str)
/*emplace(p,args)*/OK05(vec_str) OK05(deq_str) OK05(list_str)
/*insert(p,n,t) */OK06(vec_str) OK06(deq_str) OK06(list_str)
/*insert(p,b,e) */OK07(vec_str) OK07(deq_str) OK07(list_str)
/*insert(p.il) */OK08(vec_str) OK08(deq_str) OK08(list_str)
cout << "**************************add_item end****************************"
<< endl;
}
del_item/test.cpp
#include "../comm.h"
#define pop_back_f(c) { \
c.pop_back(); \
cout << " 语法正确:"#c".pop_back()" << endl; \
}
#define pop_back_e(c) { \
cout << " 语法错误:"#c".pop_back()" << endl; \
}
#define pop_front_f(c) { \
c.pop_front(); \
cout << " 语法正确:"#c".pop_front()" << endl; \
}
#define pop_front_e(c) { \
cout << " 语法错误:"#c".pop_front()" << endl; \
}
#define erase_f(c) { \
c.erase(c.begin()); \
cout << " 语法正确:"#c".erase(p)" << endl; \
}
#define erase_e(c) { \
cout << " 语法错误:"#c".erase(p)" << endl; \
}
#define erase_f2(c) { \
auto p = ++c.begin(); \
c.erase(c.begin(), p); \
cout << " 语法正确:"#c".erase(b,e)" << endl; \
}
#define erase_e2(c) { \
cout << " 语法错误:"#c".erase(b,e)" << endl; \
}
#define clear_f(c) { \
c.clear(); \
cout << " 语法正确:"#c".clear()" << endl; \
}
#define clear_e(c) { \
cout << " 语法错误:"#c".clear()" << endl; \
}
#define OK00(c) pop_back_f(c)
#define OK01(c) pop_front_f(c)
#define OK02(c) erase_f(c)
#define OK03(c) erase_f2(c)
#define OK04(c) clear_f(c)
#define NO00(c) pop_back_e(c)
#define NO01(c) pop_front_e(c)
#define NO02(c) erase_e(c)
#define NO03(c) erase_e2(c)
#define NO04(c) clear_e(c)
void delete_item() {
cout << "************************delete_item start*************************"
<< endl;
ALL;
/*pop_back */OK00(vec_str) OK00(deq_str) OK00(list_str) NO00(ary_str) NO00(fl_str)
/*pop_front */NO01(vec_str) OK01(deq_str) OK01(list_str) NO01(ary_str) OK01(fl_str)
/*erase(p) */OK02(vec_str) OK02(deq_str) OK02(list_str) NO02(ary_str) NO02(fl_str)
/*erase(b,e)*/OK03(vec_str) OK03(deq_str) OK03(list_str) NO03(ary_str) NO03(fl_str)
/*clear() */OK04(vec_str) OK04(deq_str) OK04(list_str) NO04(ary_str) OK04(fl_str)
cout << "************************delete_item end***************************"
<< endl;
}
comm.h
#ifndef COMM_H
#define COMM_H
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define init_list_cp {"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
#define init_list_int {00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
#define VEC vector vec_cp = init_list_cp; \
vector<string> vec_str = init_list_cp; \
vector<int> vec_int = init_list_int;
#define DEQUE deque deq_cp = init_list_cp; \
deque<string> deq_str = init_list_cp; \
deque<int> deq_int = init_list_int;
#define LIST list list_cp = init_list_cp; \
list<string> list_str = init_list_cp; \
list<int> list_int = init_list_int;
#define ARRARY array ary_cp = init_list_cp; \
array<string, 8> ary_str = init_list_cp; \
array<int, 8> ary_int = init_list_int;
#define FORWARD_LIST forward_list fl_cp = init_list_cp; \
forward_list<string> fl_str = init_list_cp; \
forward_list<int> fl_int = init_list_int;
#define ALL VEC \
DEQUE \
LIST \
ARRARY \
FORWARD_LIST
#endif /* COMM_H */
main.cpp
int main(int argc, char** argv) {
//定义和初始化
extern void def_and_init();
def_and_init();
//赋值和swap
extern void assign_and_swap();
assign_and_swap();
//添加元素
extern void add_item();
add_item();
//访问元素
extern void access_item();
access_item();
//删除操作
extern void delete_item();
delete_item();
return 0;
}
***********************def_and_init start*************************
--------------------------------------------------------------
C c
定义vector<const char*> c1
定义deque<const char*> c1
定义list<const char*> c1
定义array<const char*, 8> c0
定义array<const char*, 10> c1
定义forward_list<const char*> c1
定义vector<string> c1
定义deque<string> c1
定义list<string> c1
定义array<string, 8> c0
定义array<string, 10> c1
定义forward_list<string> c1
定义vector<int> c1
定义deque<int> c1
定义list<int> c1
定义array<int, 8> c0
定义array<int, 10> c1
定义forward_list<int> c1
--------------------------------------------------------------
--------------------------------------------------------------
C c1(c2)
语法正确:vector<const char*> c1(vec_cp)
语法错误:vector<const char*> c1(vec_str)
语法错误:vector<const char*> c1(vec_int)
语法错误:vector<string> c1(vec_cp)
语法正确:vector<string> c1(vec_str)
语法错误:vector<string> c1(vec_int)
语法错误:vector<int> c1(vec_cp)
语法错误:vector<int> c1(vec_str)
语法正确:vector<int> c1(vec_int)
语法正确:deque<const char*> c1(deq_cp)
语法错误:deque<const char*> c1(deq_str)
语法错误:deque<const char*> c1(deq_int)
语法错误:deque<string> c1(deq_cp)
语法正确:deque<string> c1(deq_str)
语法错误:deque<string> c1(deq_int)
语法错误:deque<int> c1(deq_cp)
语法错误:deque<int> c1(deq_str)
语法正确:deque<int> c1(deq_int)
语法正确:list<const char*> c1(list_cp)
语法错误:list<const char*> c1(list_str)
语法错误:list<const char*> c1(list_int)
语法错误:list<string> c1(list_cp)
语法正确:list<string> c1(list_str)
语法错误:list<string> c1(list_int)
语法错误:list<int> c1(list_cp)
语法错误:list<int> c1(list_str)
语法正确:list<int> c1(list_int)
语法正确:array<const char*, 8> c1(ary_cp)
语法错误:array<const char*, 8> c1(ary_str)
语法错误:array<const char*, 8> c1(ary_int)
语法错误:array<string, 8> c1(ary_cp)
语法正确:array<string, 8> c1(ary_str)
语法错误:array<string, 8> c1(ary_int)
语法错误:array<int, 8> c1(ary_cp)
语法错误:array<int, 8> c1(ary_str)
语法正确:array<int, 8> c1(ary_int)
语法正确:forward_list<const char*> c1(fl_cp)
语法错误:forward_list<const char*> c1(fl_str)
语法错误:forward_list<const char*> c1(fl_int)
语法错误:forward_list<string> c1(fl_cp)
语法正确:forward_list<string> c1(fl_str)
语法错误:forward_list<string> c1(fl_int)
语法错误:forward_list<int> c1(fl_cp)
语法错误:forward_list<int> c1(fl_str)
语法正确:forward_list<int> c1(fl_int)
--------------------------------------------------------------
--------------------------------------------------------------
C c1{a,b,c...}
语法正确:vector<const char*> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:vector<const char*> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:vector<const char*> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:vector<string> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:vector<int> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:vector<int> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:deque<const char*> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:deque<const char*> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:deque<string> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:deque<string> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:deque<int> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:deque<int> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:list<const char*> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:list<const char*> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:list<string> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:list<string> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:list<int> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:list<int> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:array<const char*, 8> c0{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:array<const char*, 10> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:array<const char*, 8> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:array<string, 8> c0{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:array<string, 10> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:array<string, 8> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:array<int, 8> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:array<int, 8> c0{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:array<int, 10> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:forward_list<const char*> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:forward_list<const char*> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:forward_list<string> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:forward_list<string> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:forward_list<int> c1{"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:forward_list<int> c1{00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
--------------------------------------------------------------
--------------------------------------------------------------
C c1={a,b,c...}
语法正确:vector<const char*> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:vector<const char*> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:vector<const char*> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:vector<string> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:vector<int> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:vector<int> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:deque<const char*> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:deque<const char*> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:deque<string> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:deque<string> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:deque<int> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:deque<int> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:list<const char*> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:list<const char*> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:list<string> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:list<string> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:list<int> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:list<int> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:array<const char*, 8> c0={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:array<const char*, 10> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:array<const char*, 8> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:array<string, 8> c0={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:array<string, 10> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:array<string, 8> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:array<int, 8> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:array<int, 8> c0={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:array<int, 10> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:forward_list<const char*> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:forward_list<const char*> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:forward_list<string> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:forward_list<string> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:forward_list<int> c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:forward_list<int> c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
--------------------------------------------------------------
--------------------------------------------------------------
C c1{b,e}
语法正确:vector<const char*> c1(vec_cp.begin(),vec_cp.end())
语法错误:vector<const char*> c1(vec_str.begin(),vec_str.end())
语法错误:vector<const char*> c1(vec_int.begin(),vec_int.end())
语法正确:vector<const char*> c1(deq_cp.begin(),deq_cp.end())
语法错误:vector<const char*> c1(deq_str.begin(),deq_str.end())
语法错误:vector<const char*> c1(deq_int.begin(),deq_int.end())
语法正确:vector<const char*> c1(list_cp.begin(),list_cp.end())
语法错误:vector<const char*> c1(list_str.begin(),list_str.end())
语法错误:vector<const char*> c1(list_int.begin(),list_int.end())
语法正确:vector<const char*> c1(ary_cp.begin(),ary_cp.end())
语法错误:vector<const char*> c1(ary_str.begin(),ary_str.end())
语法错误:vector<const char*> c1(ary_int.begin(),ary_int.end())
语法正确:vector<const char*> c1(fl_cp.begin(),fl_cp.end())
语法错误:vector<const char*> c1(fl_str.begin(),fl_str.end())
语法错误:vector<const char*> c1(fl_int.begin(),fl_int.end())
语法正确:vector<string> c1(vec_cp.begin(),vec_cp.end())
语法正确:vector<string> c1(vec_str.begin(),vec_str.end())
语法错误:vector<string> c1(vec_int.begin(),vec_int.end())
语法正确:vector<string> c1(deq_cp.begin(),deq_cp.end())
语法正确:vector<string> c1(deq_str.begin(),deq_str.end())
语法错误:vector<string> c1(deq_int.begin(),deq_int.end())
语法正确:vector<string> c1(list_cp.begin(),list_cp.end())
语法正确:vector<string> c1(list_str.begin(),list_str.end())
语法错误:vector<string> c1(list_int.begin(),list_int.end())
语法正确:vector<string> c1(ary_cp.begin(),ary_cp.end())
语法正确:vector<string> c1(ary_str.begin(),ary_str.end())
语法错误:vector<string> c1(ary_int.begin(),ary_int.end())
语法正确:vector<string> c1(fl_cp.begin(),fl_cp.end())
语法正确:vector<string> c1(fl_str.begin(),fl_str.end())
语法错误:vector<string> c1(fl_int.begin(),fl_int.end())
语法错误:vector<int> c1(vec_cp.begin(),vec_cp.end())
语法错误:vector<int> c1(vec_str.begin(),vec_str.end())
语法正确:vector<int> c1(vec_int.begin(),vec_int.end())
语法错误:vector<int> c1(deq_cp.begin(),deq_cp.end())
语法错误:vector<int> c1(deq_str.begin(),deq_str.end())
语法正确:vector<int> c1(deq_int.begin(),deq_int.end())
语法错误:vector<int> c1(list_cp.begin(),list_cp.end())
语法错误:vector<int> c1(list_str.begin(),list_str.end())
语法正确:vector<int> c1(list_int.begin(),list_int.end())
语法错误:vector<int> c1(ary_cp.begin(),ary_cp.end())
语法错误:vector<int> c1(ary_str.begin(),ary_str.end())
语法正确:vector<int> c1(ary_int.begin(),ary_int.end())
语法错误:vector<int> c1(fl_cp.begin(),fl_cp.end())
语法错误:vector<int> c1(fl_str.begin(),fl_str.end())
语法正确:vector<int> c1(fl_int.begin(),fl_int.end())
语法正确:deque<const char*> c1(vec_cp.begin(),vec_cp.end())
语法错误:deque<const char*> c1(vec_str.begin(),vec_str.end())
语法错误:deque<const char*> c1(vec_int.begin(),vec_int.end())
语法正确:deque<const char*> c1(deq_cp.begin(),deq_cp.end())
语法错误:deque<const char*> c1(deq_str.begin(),deq_str.end())
语法错误:deque<const char*> c1(deq_int.begin(),deq_int.end())
语法正确:deque<const char*> c1(list_cp.begin(),list_cp.end())
语法错误:deque<const char*> c1(list_str.begin(),list_str.end())
语法错误:deque<const char*> c1(list_int.begin(),list_int.end())
语法正确:deque<const char*> c1(ary_cp.begin(),ary_cp.end())
语法错误:deque<const char*> c1(ary_str.begin(),ary_str.end())
语法错误:deque<const char*> c1(ary_int.begin(),ary_int.end())
语法正确:deque<const char*> c1(fl_cp.begin(),fl_cp.end())
语法错误:deque<const char*> c1(fl_str.begin(),fl_str.end())
语法错误:deque<const char*> c1(fl_int.begin(),fl_int.end())
语法正确:deque<string> c1(vec_cp.begin(),vec_cp.end())
语法正确:deque<string> c1(vec_str.begin(),vec_str.end())
语法错误:deque<string> c1(vec_int.begin(),vec_int.end())
语法正确:deque<string> c1(deq_cp.begin(),deq_cp.end())
语法正确:deque<string> c1(deq_str.begin(),deq_str.end())
语法错误:deque<string> c1(deq_int.begin(),deq_int.end())
语法正确:deque<string> c1(list_cp.begin(),list_cp.end())
语法正确:deque<string> c1(list_str.begin(),list_str.end())
语法错误:deque<string> c1(list_int.begin(),list_int.end())
语法正确:deque<string> c1(ary_cp.begin(),ary_cp.end())
语法正确:deque<string> c1(ary_str.begin(),ary_str.end())
语法错误:deque<string> c1(ary_int.begin(),ary_int.end())
语法正确:deque<string> c1(fl_cp.begin(),fl_cp.end())
语法正确:deque<string> c1(fl_str.begin(),fl_str.end())
语法错误:deque<string> c1(fl_int.begin(),fl_int.end())
语法错误:deque<int> c1(vec_cp.begin(),vec_cp.end())
语法错误:deque<int> c1(vec_str.begin(),vec_str.end())
语法正确:deque<int> c1(vec_int.begin(),vec_int.end())
语法错误:deque<int> c1(deq_cp.begin(),deq_cp.end())
语法错误:deque<int> c1(deq_str.begin(),deq_str.end())
语法正确:deque<int> c1(deq_int.begin(),deq_int.end())
语法错误:deque<int> c1(list_cp.begin(),list_cp.end())
语法错误:deque<int> c1(list_str.begin(),list_str.end())
语法正确:deque<int> c1(list_int.begin(),list_int.end())
语法错误:deque<int> c1(ary_cp.begin(),ary_cp.end())
语法错误:deque<int> c1(ary_str.begin(),ary_str.end())
语法正确:deque<int> c1(ary_int.begin(),ary_int.end())
语法错误:deque<int> c1(fl_cp.begin(),fl_cp.end())
语法错误:deque<int> c1(fl_str.begin(),fl_str.end())
语法正确:deque<int> c1(fl_int.begin(),fl_int.end())
语法正确:list<const char*> c1(vec_cp.begin(),vec_cp.end())
语法错误:list<const char*> c1(vec_str.begin(),vec_str.end())
语法错误:list<const char*> c1(vec_int.begin(),vec_int.end())
语法正确:list<const char*> c1(deq_cp.begin(),deq_cp.end())
语法错误:list<const char*> c1(deq_str.begin(),deq_str.end())
语法错误:list<const char*> c1(deq_int.begin(),deq_int.end())
语法正确:list<const char*> c1(list_cp.begin(),list_cp.end())
语法错误:list<const char*> c1(list_str.begin(),list_str.end())
语法错误:list<const char*> c1(list_int.begin(),list_int.end())
语法正确:list<const char*> c1(ary_cp.begin(),ary_cp.end())
语法错误:list<const char*> c1(ary_str.begin(),ary_str.end())
语法错误:list<const char*> c1(ary_int.begin(),ary_int.end())
语法正确:list<const char*> c1(fl_cp.begin(),fl_cp.end())
语法错误:list<const char*> c1(fl_str.begin(),fl_str.end())
语法错误:list<const char*> c1(fl_int.begin(),fl_int.end())
语法正确:list<string> c1(vec_cp.begin(),vec_cp.end())
语法正确:list<string> c1(vec_str.begin(),vec_str.end())
语法错误:list<string> c1(vec_int.begin(),vec_int.end())
语法正确:list<string> c1(deq_cp.begin(),deq_cp.end())
语法正确:list<string> c1(deq_str.begin(),deq_str.end())
语法错误:list<string> c1(deq_int.begin(),deq_int.end())
语法正确:list<string> c1(list_cp.begin(),list_cp.end())
语法正确:list<string> c1(list_str.begin(),list_str.end())
语法错误:list<string> c1(list_int.begin(),list_int.end())
语法正确:list<string> c1(ary_cp.begin(),ary_cp.end())
语法正确:list<string> c1(ary_str.begin(),ary_str.end())
语法错误:list<string> c1(ary_int.begin(),ary_int.end())
语法正确:list<string> c1(fl_cp.begin(),fl_cp.end())
语法正确:list<string> c1(fl_str.begin(),fl_str.end())
语法错误:list<string> c1(fl_int.begin(),fl_int.end())
语法错误:list<int> c1(vec_cp.begin(),vec_cp.end())
语法错误:list<int> c1(vec_str.begin(),vec_str.end())
语法正确:list<int> c1(vec_int.begin(),vec_int.end())
语法错误:list<int> c1(deq_cp.begin(),deq_cp.end())
语法错误:list<int> c1(deq_str.begin(),deq_str.end())
语法正确:list<int> c1(deq_int.begin(),deq_int.end())
语法错误:list<int> c1(list_cp.begin(),list_cp.end())
语法错误:list<int> c1(list_str.begin(),list_str.end())
语法正确:list<int> c1(list_int.begin(),list_int.end())
语法错误:list<int> c1(ary_cp.begin(),ary_cp.end())
语法错误:list<int> c1(ary_str.begin(),ary_str.end())
语法正确:list<int> c1(ary_int.begin(),ary_int.end())
语法错误:list<int> c1(fl_cp.begin(),fl_cp.end())
语法错误:list<int> c1(fl_str.begin(),fl_str.end())
语法正确:list<int> c1(fl_int.begin(),fl_int.end())
语法错误:array<const char*, 8> c1(vec_cp.begin(),vec_cp.end())
语法错误:array<const char*, 8> c1(vec_str.begin(),vec_str.end())
语法错误:array<const char*, 8> c1(vec_int.begin(),vec_int.end())
语法错误:array<const char*, 8> c1(deq_cp.begin(),deq_cp.end())
语法错误:array<const char*, 8> c1(deq_str.begin(),deq_str.end())
语法错误:array<const char*, 8> c1(deq_int.begin(),deq_int.end())
语法错误:array<const char*, 8> c1(list_cp.begin(),list_cp.end())
语法错误:array<const char*, 8> c1(list_str.begin(),list_str.end())
语法错误:array<const char*, 8> c1(list_int.begin(),list_int.end())
语法错误:array<const char*, 8> c1(ary_cp.begin(),ary_cp.end())
语法错误:array<const char*, 8> c1(ary_str.begin(),ary_str.end())
语法错误:array<const char*, 8> c1(ary_int.begin(),ary_int.end())
语法错误:array<const char*, 8> c1(fl_cp.begin(),fl_cp.end())
语法错误:array<const char*, 8> c1(fl_str.begin(),fl_str.end())
语法错误:array<const char*, 8> c1(fl_int.begin(),fl_int.end())
语法错误:array<string, 8> c1(vec_cp.begin(),vec_cp.end())
语法错误:array<string, 8> c1(vec_str.begin(),vec_str.end())
语法错误:array<string, 8> c1(vec_int.begin(),vec_int.end())
语法错误:array<string, 8> c1(deq_cp.begin(),deq_cp.end())
语法错误:array<string, 8> c1(deq_str.begin(),deq_str.end())
语法错误:array<string, 8> c1(deq_int.begin(),deq_int.end())
语法错误:array<string, 8> c1(list_cp.begin(),list_cp.end())
语法错误:array<string, 8> c1(list_str.begin(),list_str.end())
语法错误:array<string, 8> c1(list_int.begin(),list_int.end())
语法错误:array<string, 8> c1(ary_cp.begin(),ary_cp.end())
语法错误:array<string, 8> c1(ary_str.begin(),ary_str.end())
语法错误:array<string, 8> c1(ary_int.begin(),ary_int.end())
语法错误:array<string, 8> c1(fl_cp.begin(),fl_cp.end())
语法错误:array<string, 8> c1(fl_str.begin(),fl_str.end())
语法错误:array<string, 8> c1(fl_int.begin(),fl_int.end())
语法错误:array<int, 8> c1(vec_cp.begin(),vec_cp.end())
语法错误:array<int, 8> c1(vec_str.begin(),vec_str.end())
语法错误:array<int, 8> c1(vec_int.begin(),vec_int.end())
语法错误:array<int, 8> c1(deq_cp.begin(),deq_cp.end())
语法错误:array<int, 8> c1(deq_str.begin(),deq_str.end())
语法错误:array<int, 8> c1(deq_int.begin(),deq_int.end())
语法错误:array<int, 8> c1(list_cp.begin(),list_cp.end())
语法错误:array<int, 8> c1(list_str.begin(),list_str.end())
语法错误:array<int, 8> c1(list_int.begin(),list_int.end())
语法错误:array<int, 8> c1(ary_cp.begin(),ary_cp.end())
语法错误:array<int, 8> c1(ary_str.begin(),ary_str.end())
语法错误:array<int, 8> c1(ary_int.begin(),ary_int.end())
语法错误:array<int, 8> c1(fl_cp.begin(),fl_cp.end())
语法错误:array<int, 8> c1(fl_str.begin(),fl_str.end())
语法错误:array<int, 8> c1(fl_int.begin(),fl_int.end())
语法正确:forward_list<const char*> c1(vec_cp.begin(),vec_cp.end())
语法错误:forward_list<const char*> c1(vec_str.begin(),vec_str.end())
语法错误:forward_list<const char*> c1(vec_int.begin(),vec_int.end())
语法正确:forward_list<const char*> c1(deq_cp.begin(),deq_cp.end())
语法错误:forward_list<const char*> c1(deq_str.begin(),deq_str.end())
语法错误:forward_list<const char*> c1(deq_int.begin(),deq_int.end())
语法正确:forward_list<const char*> c1(list_cp.begin(),list_cp.end())
语法错误:forward_list<const char*> c1(list_str.begin(),list_str.end())
语法错误:forward_list<const char*> c1(list_int.begin(),list_int.end())
语法正确:forward_list<const char*> c1(ary_cp.begin(),ary_cp.end())
语法错误:forward_list<const char*> c1(ary_str.begin(),ary_str.end())
语法错误:forward_list<const char*> c1(ary_int.begin(),ary_int.end())
语法正确:forward_list<const char*> c1(fl_cp.begin(),fl_cp.end())
语法错误:forward_list<const char*> c1(fl_str.begin(),fl_str.end())
语法错误:forward_list<const char*> c1(fl_int.begin(),fl_int.end())
语法正确:forward_list<string> c1(vec_cp.begin(),vec_cp.end())
语法正确:forward_list<string> c1(vec_str.begin(),vec_str.end())
语法错误:forward_list<string> c1(vec_int.begin(),vec_int.end())
语法正确:forward_list<string> c1(deq_cp.begin(),deq_cp.end())
语法正确:forward_list<string> c1(deq_str.begin(),deq_str.end())
语法错误:forward_list<string> c1(deq_int.begin(),deq_int.end())
语法正确:forward_list<string> c1(list_cp.begin(),list_cp.end())
语法正确:forward_list<string> c1(list_str.begin(),list_str.end())
语法错误:forward_list<string> c1(list_int.begin(),list_int.end())
语法正确:forward_list<string> c1(ary_cp.begin(),ary_cp.end())
语法正确:forward_list<string> c1(ary_str.begin(),ary_str.end())
语法错误:forward_list<string> c1(ary_int.begin(),ary_int.end())
语法正确:forward_list<string> c1(fl_cp.begin(),fl_cp.end())
语法正确:forward_list<string> c1(fl_str.begin(),fl_str.end())
语法错误:forward_list<string> c1(fl_int.begin(),fl_int.end())
语法错误:forward_list<int> c1(vec_cp.begin(),vec_cp.end())
语法错误:forward_list<int> c1(vec_str.begin(),vec_str.end())
语法正确:forward_list<int> c1(vec_int.begin(),vec_int.end())
语法错误:forward_list<int> c1(deq_cp.begin(),deq_cp.end())
语法错误:forward_list<int> c1(deq_str.begin(),deq_str.end())
语法正确:forward_list<int> c1(deq_int.begin(),deq_int.end())
语法错误:forward_list<int> c1(list_cp.begin(),list_cp.end())
语法错误:forward_list<int> c1(list_str.begin(),list_str.end())
语法正确:forward_list<int> c1(list_int.begin(),list_int.end())
语法错误:forward_list<int> c1(ary_cp.begin(),ary_cp.end())
语法错误:forward_list<int> c1(ary_str.begin(),ary_str.end())
语法正确:forward_list<int> c1(ary_int.begin(),ary_int.end())
语法错误:forward_list<int> c1(fl_cp.begin(),fl_cp.end())
语法错误:forward_list<int> c1(fl_str.begin(),fl_str.end())
语法正确:forward_list<int> c1(fl_int.begin(),fl_int.end())
--------------------------------------------------------------
--------------------------------------------------------------
C seq(n)
定义vector<const char*> seq(8)
定义deque<const char*> seq(8)
定义list<const char*> seq(8)
定义array<const char*, 8> seq0
定义array<const char*, 10> seq1
定义forward_list<const char*> seq(8)
定义vector<string> seq(8)
定义deque<string> seq(8)
定义list<string> seq(8)
定义array<string, 8> seq0
定义array<string, 10> seq1
定义forward_list<string> seq(8)
定义vector<int> seq(8)
定义deque<int> seq(8)
定义list<int> seq(8)
定义array<int, 8> seq0
定义array<int, 10> seq1
定义forward_list<int> seq(8)
--------------------------------------------------------------
--------------------------------------------------------------
C seq(n)
语法正确:vector<const char*> c1(8,"str")
语法正确:vector<string> c1(8,"str")
语法正确:vector<int> c1(8,12345)
语法正确:deque<const char*> c1(8,"str")
语法正确:deque<string> c1(8,"str")
语法正确:deque<int> c1(8,12345)
语法正确:list<const char*> c1(8,"str")
语法正确:list<string> c1(8,"str")
语法正确:list<int> c1(8,12345)
语法错误:array<const char*, 8> c1(8,"str")
语法错误:array<string, 8> c1(8,"str")
语法错误:array<int, 8> c1(8,12345)
语法正确:forward_list<const char*> c1(8,"str")
语法正确:forward_list<string> c1(8,"str")
语法正确:forward_list<int> c1(8,12345)
--------------------------------------------------------------
***********************def_and_init end***************************
**********************assign_and_swap start***********************
--------------------------------------------------------------
c1=c2
语法正确:vector<const char*> c1=vec_cp
语法错误:vector<const char*> c1=vec_str
语法错误:vector<const char*> c1=vec_int
语法错误:vector<string> c1=vec_cp
语法正确:vector<string> c1=vec_str
语法错误:vector<string> c1=vec_int
语法错误:vector<int> c1=vec_cp
语法错误:vector<int> c1=vec_str
语法正确:vector<int> c1=vec_int
语法正确:deque<const char*> c1=deq_cp
语法错误:deque<const char*> c1=deq_str
语法错误:deque<const char*> c1=deq_int
语法错误:deque<string> c1=deq_cp
语法正确:deque<string> c1=deq_str
语法错误:deque<string> c1=deq_int
语法错误:deque<int> c1=deq_cp
语法错误:deque<int> c1=deq_str
语法正确:deque<int> c1=deq_int
语法正确:list<const char*> c1=list_cp
语法错误:list<const char*> c1=list_str
语法错误:list<const char*> c1=list_int
语法错误:list<string> c1=list_cp
语法正确:list<string> c1=list_str
语法错误:list<string> c1=list_int
语法错误:list<int> c1=list_cp
语法错误:list<int> c1=list_str
语法正确:list<int> c1=list_int
语法正确:array<const char*, 8> c1=ary_cp
语法错误:array<const char*, 8> c1=ary_str
语法错误:array<const char*, 8> c1=ary_int
语法错误:array<string, 8> c1=ary_cp
语法正确:array<string, 8> c1=ary_str
语法错误:array<string, 8> c1=ary_int
语法错误:array<int, 8> c1=ary_cp
语法错误:array<int, 8> c1=ary_str
语法正确:array<int, 8> c1=ary_int
语法正确:forward_list<const char*> c1=fl_cp
语法错误:forward_list<const char*> c1=fl_str
语法错误:forward_list<const char*> c1=fl_int
语法错误:forward_list<string> c1=fl_cp
语法正确:forward_list<string> c1=fl_str
语法错误:forward_list<string> c1=fl_int
语法错误:forward_list<int> c1=fl_cp
语法错误:forward_list<int> c1=fl_str
语法正确:forward_list<int> c1=fl_int
--------------------------------------------------------------
--------------------------------------------------------------
c1.assign(b,e)
语法正确:vector<const char*> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:vector<const char*> c1.assign(vec_str.begin(),vec_str.end())
语法错误:vector<const char*> c1.assign(vec_int.begin(),vec_int.end())
语法正确:vector<const char*> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:vector<const char*> c1.assign(deq_str.begin(),deq_str.end())
语法错误:vector<const char*> c1.assign(deq_int.begin(),deq_int.end())
语法正确:vector<const char*> c1.assign(list_cp.begin(),list_cp.end())
语法错误:vector<const char*> c1.assign(list_str.begin(),list_str.end())
语法错误:vector<const char*> c1.assign(list_int.begin(),list_int.end())
语法正确:vector<const char*> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:vector<const char*> c1.assign(ary_str.begin(),ary_str.end())
语法错误:vector<const char*> c1.assign(ary_int.begin(),ary_int.end())
语法正确:vector<const char*> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:vector<const char*> c1.assign(fl_str.begin(),fl_str.end())
语法错误:vector<const char*> c1.assign(fl_int.begin(),fl_int.end())
语法正确:vector<string> c1.assign(vec_cp.begin(),vec_cp.end())
语法正确:vector<string> c1.assign(vec_str.begin(),vec_str.end())
语法错误:vector<string> c1.assign(vec_int.begin(),vec_int.end())
语法正确:vector<string> c1.assign(deq_cp.begin(),deq_cp.end())
语法正确:vector<string> c1.assign(deq_str.begin(),deq_str.end())
语法错误:vector<string> c1.assign(deq_int.begin(),deq_int.end())
语法正确:vector<string> c1.assign(list_cp.begin(),list_cp.end())
语法正确:vector<string> c1.assign(list_str.begin(),list_str.end())
语法错误:vector<string> c1.assign(list_int.begin(),list_int.end())
语法正确:vector<string> c1.assign(ary_cp.begin(),ary_cp.end())
语法正确:vector<string> c1.assign(ary_str.begin(),ary_str.end())
语法错误:vector<string> c1.assign(ary_int.begin(),ary_int.end())
语法正确:vector<string> c1.assign(fl_cp.begin(),fl_cp.end())
语法正确:vector<string> c1.assign(fl_str.begin(),fl_str.end())
语法错误:vector<string> c1.assign(fl_int.begin(),fl_int.end())
语法错误:vector<int> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:vector<int> c1.assign(vec_str.begin(),vec_str.end())
语法正确:vector<int> c1.assign(vec_int.begin(),vec_int.end())
语法错误:vector<int> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:vector<int> c1.assign(deq_str.begin(),deq_str.end())
语法正确:vector<int> c1.assign(deq_int.begin(),deq_int.end())
语法错误:vector<int> c1.assign(list_cp.begin(),list_cp.end())
语法错误:vector<int> c1.assign(list_str.begin(),list_str.end())
语法正确:vector<int> c1.assign(list_int.begin(),list_int.end())
语法错误:vector<int> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:vector<int> c1.assign(ary_str.begin(),ary_str.end())
语法正确:vector<int> c1.assign(ary_int.begin(),ary_int.end())
语法错误:vector<int> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:vector<int> c1.assign(fl_str.begin(),fl_str.end())
语法正确:vector<int> c1.assign(fl_int.begin(),fl_int.end())
语法正确:deque<const char*> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:deque<const char*> c1.assign(vec_str.begin(),vec_str.end())
语法错误:deque<const char*> c1.assign(vec_int.begin(),vec_int.end())
语法正确:deque<const char*> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:deque<const char*> c1.assign(deq_str.begin(),deq_str.end())
语法错误:deque<const char*> c1.assign(deq_int.begin(),deq_int.end())
语法正确:deque<const char*> c1.assign(list_cp.begin(),list_cp.end())
语法错误:deque<const char*> c1.assign(list_str.begin(),list_str.end())
语法错误:deque<const char*> c1.assign(list_int.begin(),list_int.end())
语法正确:deque<const char*> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:deque<const char*> c1.assign(ary_str.begin(),ary_str.end())
语法错误:deque<const char*> c1.assign(ary_int.begin(),ary_int.end())
语法正确:deque<const char*> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:deque<const char*> c1.assign(fl_str.begin(),fl_str.end())
语法错误:deque<const char*> c1.assign(fl_int.begin(),fl_int.end())
语法正确:deque<string> c1.assign(vec_cp.begin(),vec_cp.end())
语法正确:deque<string> c1.assign(vec_str.begin(),vec_str.end())
语法错误:deque<string> c1.assign(vec_int.begin(),vec_int.end())
语法正确:deque<string> c1.assign(deq_cp.begin(),deq_cp.end())
语法正确:deque<string> c1.assign(deq_str.begin(),deq_str.end())
语法错误:deque<string> c1.assign(deq_int.begin(),deq_int.end())
语法正确:deque<string> c1.assign(list_cp.begin(),list_cp.end())
语法正确:deque<string> c1.assign(list_str.begin(),list_str.end())
语法错误:deque<string> c1.assign(list_int.begin(),list_int.end())
语法正确:deque<string> c1.assign(ary_cp.begin(),ary_cp.end())
语法正确:deque<string> c1.assign(ary_str.begin(),ary_str.end())
语法错误:deque<string> c1.assign(ary_int.begin(),ary_int.end())
语法正确:deque<string> c1.assign(fl_cp.begin(),fl_cp.end())
语法正确:deque<string> c1.assign(fl_str.begin(),fl_str.end())
语法错误:deque<string> c1.assign(fl_int.begin(),fl_int.end())
语法错误:deque<int> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:deque<int> c1.assign(vec_str.begin(),vec_str.end())
语法正确:deque<int> c1.assign(vec_int.begin(),vec_int.end())
语法错误:deque<int> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:deque<int> c1.assign(deq_str.begin(),deq_str.end())
语法正确:deque<int> c1.assign(deq_int.begin(),deq_int.end())
语法错误:deque<int> c1.assign(list_cp.begin(),list_cp.end())
语法错误:deque<int> c1.assign(list_str.begin(),list_str.end())
语法正确:deque<int> c1.assign(list_int.begin(),list_int.end())
语法错误:deque<int> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:deque<int> c1.assign(ary_str.begin(),ary_str.end())
语法正确:deque<int> c1.assign(ary_int.begin(),ary_int.end())
语法错误:deque<int> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:deque<int> c1.assign(fl_str.begin(),fl_str.end())
语法正确:deque<int> c1.assign(fl_int.begin(),fl_int.end())
语法正确:list<const char*> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:list<const char*> c1.assign(vec_str.begin(),vec_str.end())
语法错误:list<const char*> c1.assign(vec_int.begin(),vec_int.end())
语法正确:list<const char*> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:list<const char*> c1.assign(deq_str.begin(),deq_str.end())
语法错误:list<const char*> c1.assign(deq_int.begin(),deq_int.end())
语法正确:list<const char*> c1.assign(list_cp.begin(),list_cp.end())
语法错误:list<const char*> c1.assign(list_str.begin(),list_str.end())
语法错误:list<const char*> c1.assign(list_int.begin(),list_int.end())
语法正确:list<const char*> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:list<const char*> c1.assign(ary_str.begin(),ary_str.end())
语法错误:list<const char*> c1.assign(ary_int.begin(),ary_int.end())
语法正确:list<const char*> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:list<const char*> c1.assign(fl_str.begin(),fl_str.end())
语法错误:list<const char*> c1.assign(fl_int.begin(),fl_int.end())
语法正确:list<string> c1.assign(vec_cp.begin(),vec_cp.end())
语法正确:list<string> c1.assign(vec_str.begin(),vec_str.end())
语法错误:list<string> c1.assign(vec_int.begin(),vec_int.end())
语法正确:list<string> c1.assign(deq_cp.begin(),deq_cp.end())
语法正确:list<string> c1.assign(deq_str.begin(),deq_str.end())
语法错误:list<string> c1.assign(deq_int.begin(),deq_int.end())
语法正确:list<string> c1.assign(list_cp.begin(),list_cp.end())
语法正确:list<string> c1.assign(list_str.begin(),list_str.end())
语法错误:list<string> c1.assign(list_int.begin(),list_int.end())
语法正确:list<string> c1.assign(ary_cp.begin(),ary_cp.end())
语法正确:list<string> c1.assign(ary_str.begin(),ary_str.end())
语法错误:list<string> c1.assign(ary_int.begin(),ary_int.end())
语法正确:list<string> c1.assign(fl_cp.begin(),fl_cp.end())
语法正确:list<string> c1.assign(fl_str.begin(),fl_str.end())
语法错误:list<string> c1.assign(fl_int.begin(),fl_int.end())
语法错误:list<int> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:list<int> c1.assign(vec_str.begin(),vec_str.end())
语法正确:list<int> c1.assign(vec_int.begin(),vec_int.end())
语法错误:list<int> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:list<int> c1.assign(deq_str.begin(),deq_str.end())
语法正确:list<int> c1.assign(deq_int.begin(),deq_int.end())
语法错误:list<int> c1.assign(list_cp.begin(),list_cp.end())
语法错误:list<int> c1.assign(list_str.begin(),list_str.end())
语法正确:list<int> c1.assign(list_int.begin(),list_int.end())
语法错误:list<int> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:list<int> c1.assign(ary_str.begin(),ary_str.end())
语法正确:list<int> c1.assign(ary_int.begin(),ary_int.end())
语法错误:list<int> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:list<int> c1.assign(fl_str.begin(),fl_str.end())
语法正确:list<int> c1.assign(fl_int.begin(),fl_int.end())
语法错误:array<const char*, 8> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:array<const char*, 8> c1.assign(vec_str.begin(),vec_str.end())
语法错误:array<const char*, 8> c1.assign(vec_int.begin(),vec_int.end())
语法错误:array<const char*, 8> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:array<const char*, 8> c1.assign(deq_str.begin(),deq_str.end())
语法错误:array<const char*, 8> c1.assign(deq_int.begin(),deq_int.end())
语法错误:array<const char*, 8> c1.assign(list_cp.begin(),list_cp.end())
语法错误:array<const char*, 8> c1.assign(list_str.begin(),list_str.end())
语法错误:array<const char*, 8> c1.assign(list_int.begin(),list_int.end())
语法错误:array<const char*, 8> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:array<const char*, 8> c1.assign(ary_str.begin(),ary_str.end())
语法错误:array<const char*, 8> c1.assign(ary_int.begin(),ary_int.end())
语法错误:array<const char*, 8> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:array<const char*, 8> c1.assign(fl_str.begin(),fl_str.end())
语法错误:array<const char*, 8> c1.assign(fl_int.begin(),fl_int.end())
语法错误:array<string, 8> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:array<string, 8> c1.assign(vec_str.begin(),vec_str.end())
语法错误:array<string, 8> c1.assign(vec_int.begin(),vec_int.end())
语法错误:array<string, 8> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:array<string, 8> c1.assign(deq_str.begin(),deq_str.end())
语法错误:array<string, 8> c1.assign(deq_int.begin(),deq_int.end())
语法错误:array<string, 8> c1.assign(list_cp.begin(),list_cp.end())
语法错误:array<string, 8> c1.assign(list_str.begin(),list_str.end())
语法错误:array<string, 8> c1.assign(list_int.begin(),list_int.end())
语法错误:array<string, 8> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:array<string, 8> c1.assign(ary_str.begin(),ary_str.end())
语法错误:array<string, 8> c1.assign(ary_int.begin(),ary_int.end())
语法错误:array<string, 8> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:array<string, 8> c1.assign(fl_str.begin(),fl_str.end())
语法错误:array<string, 8> c1.assign(fl_int.begin(),fl_int.end())
语法错误:array<int, 8> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:array<int, 8> c1.assign(vec_str.begin(),vec_str.end())
语法错误:array<int, 8> c1.assign(vec_int.begin(),vec_int.end())
语法错误:array<int, 8> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:array<int, 8> c1.assign(deq_str.begin(),deq_str.end())
语法错误:array<int, 8> c1.assign(deq_int.begin(),deq_int.end())
语法错误:array<int, 8> c1.assign(list_cp.begin(),list_cp.end())
语法错误:array<int, 8> c1.assign(list_str.begin(),list_str.end())
语法错误:array<int, 8> c1.assign(list_int.begin(),list_int.end())
语法错误:array<int, 8> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:array<int, 8> c1.assign(ary_str.begin(),ary_str.end())
语法错误:array<int, 8> c1.assign(ary_int.begin(),ary_int.end())
语法错误:array<int, 8> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:array<int, 8> c1.assign(fl_str.begin(),fl_str.end())
语法错误:array<int, 8> c1.assign(fl_int.begin(),fl_int.end())
语法正确:forward_list<const char*> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:forward_list<const char*> c1.assign(vec_str.begin(),vec_str.end())
语法错误:forward_list<const char*> c1.assign(vec_int.begin(),vec_int.end())
语法正确:forward_list<const char*> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:forward_list<const char*> c1.assign(deq_str.begin(),deq_str.end())
语法错误:forward_list<const char*> c1.assign(deq_int.begin(),deq_int.end())
语法正确:forward_list<const char*> c1.assign(list_cp.begin(),list_cp.end())
语法错误:forward_list<const char*> c1.assign(list_str.begin(),list_str.end())
语法错误:forward_list<const char*> c1.assign(list_int.begin(),list_int.end())
语法正确:forward_list<const char*> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:forward_list<const char*> c1.assign(ary_str.begin(),ary_str.end())
语法错误:forward_list<const char*> c1.assign(ary_int.begin(),ary_int.end())
语法正确:forward_list<const char*> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:forward_list<const char*> c1.assign(fl_str.begin(),fl_str.end())
语法错误:forward_list<const char*> c1.assign(fl_int.begin(),fl_int.end())
语法正确:forward_list<string> c1.assign(vec_cp.begin(),vec_cp.end())
语法正确:forward_list<string> c1.assign(vec_str.begin(),vec_str.end())
语法错误:forward_list<string> c1.assign(vec_int.begin(),vec_int.end())
语法正确:forward_list<string> c1.assign(deq_cp.begin(),deq_cp.end())
语法正确:forward_list<string> c1.assign(deq_str.begin(),deq_str.end())
语法错误:forward_list<string> c1.assign(deq_int.begin(),deq_int.end())
语法正确:forward_list<string> c1.assign(list_cp.begin(),list_cp.end())
语法正确:forward_list<string> c1.assign(list_str.begin(),list_str.end())
语法错误:forward_list<string> c1.assign(list_int.begin(),list_int.end())
语法正确:forward_list<string> c1.assign(ary_cp.begin(),ary_cp.end())
语法正确:forward_list<string> c1.assign(ary_str.begin(),ary_str.end())
语法错误:forward_list<string> c1.assign(ary_int.begin(),ary_int.end())
语法正确:forward_list<string> c1.assign(fl_cp.begin(),fl_cp.end())
语法正确:forward_list<string> c1.assign(fl_str.begin(),fl_str.end())
语法错误:forward_list<string> c1.assign(fl_int.begin(),fl_int.end())
语法错误:forward_list<int> c1.assign(vec_cp.begin(),vec_cp.end())
语法错误:forward_list<int> c1.assign(vec_str.begin(),vec_str.end())
语法正确:forward_list<int> c1.assign(vec_int.begin(),vec_int.end())
语法错误:forward_list<int> c1.assign(deq_cp.begin(),deq_cp.end())
语法错误:forward_list<int> c1.assign(deq_str.begin(),deq_str.end())
语法正确:forward_list<int> c1.assign(deq_int.begin(),deq_int.end())
语法错误:forward_list<int> c1.assign(list_cp.begin(),list_cp.end())
语法错误:forward_list<int> c1.assign(list_str.begin(),list_str.end())
语法正确:forward_list<int> c1.assign(list_int.begin(),list_int.end())
语法错误:forward_list<int> c1.assign(ary_cp.begin(),ary_cp.end())
语法错误:forward_list<int> c1.assign(ary_str.begin(),ary_str.end())
语法正确:forward_list<int> c1.assign(ary_int.begin(),ary_int.end())
语法错误:forward_list<int> c1.assign(fl_cp.begin(),fl_cp.end())
语法错误:forward_list<int> c1.assign(fl_str.begin(),fl_str.end())
语法正确:forward_list<int> c1.assign(fl_int.begin(),fl_int.end())
--------------------------------------------------------------
--------------------------------------------------------------
c1 assign il
vector<const char*>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
vector<const char*>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
vector<string>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
vector<string>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
vector<int>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
vector<int>
语法正确:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
deque<const char*>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
deque<const char*>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
deque<string>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
deque<string>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
deque<int>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
deque<int>
语法正确:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
list<const char*>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
list<const char*>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
list<string>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
list<string>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
list<int>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
list<int>
语法正确:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
array<const char*>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
array<const char*>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
array<string>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
array<string>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
array<int>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
array<int>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
forward_list<const char*>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
forward_list<const char*>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
forward_list<string>
语法正确:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法正确:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
forward_list<string>
语法错误:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法错误:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
forward_list<int>
语法错误:c1={"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"}
语法错误:c1.assign({"cp0", "cp1", "cp2", "cp3", "cp4", "cp5", "cp6", "cp7"})
forward_list<int>
语法正确:c1={00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777}
语法正确:c1.assign({00000, 11111, 22222, 33333, 44444, 55555, 66666, 77777})
--------------------------------------------------------------
--------------------------------------------------------------
swap c1 c2
vector<const char*> c1
语法正确:c1.swap(vec_cp)
语法正确:swap(c1, vec_cp)
vector<const char*> c1
语法错误:c1.swap(vec_str)
语法错误:swap(c1, vec_str)
vector<const char*> c1
语法错误:c1.swap(vec_int)
语法错误:swap(c1, vec_int)
vector<string> c1
语法错误:c1.swap(vec_cp)
语法错误:swap(c1, vec_cp)
vector<string> c1
语法正确:c1.swap(vec_str)
语法正确:swap(c1, vec_str)
vector<string> c1
语法错误:c1.swap(vec_int)
语法错误:swap(c1, vec_int)
vector<int> c1
语法错误:c1.swap(vec_cp)
语法错误:swap(c1, vec_cp)
vector<int> c1
语法错误:c1.swap(vec_str)
语法错误:swap(c1, vec_str)
vector<int> c1
语法正确:c1.swap(vec_int)
语法正确:swap(c1, vec_int)
deque<const char*> c1
语法正确:c1.swap(deq_cp)
语法正确:swap(c1, deq_cp)
deque<const char*> c1
语法错误:c1.swap(deq_str)
语法错误:swap(c1, deq_str)
deque<const char*> c1
语法错误:c1.swap(deq_int)
语法错误:swap(c1, deq_int)
deque<string> c1
语法错误:c1.swap(deq_cp)
语法错误:swap(c1, deq_cp)
deque<string> c1
语法正确:c1.swap(deq_str)
语法正确:swap(c1, deq_str)
deque<string> c1
语法错误:c1.swap(deq_int)
语法错误:swap(c1, deq_int)
deque<int> c1
语法错误:c1.swap(deq_cp)
语法错误:swap(c1, deq_cp)
deque<int> c1
语法错误:c1.swap(deq_str)
语法错误:swap(c1, deq_str)
deque<int> c1
语法正确:c1.swap(deq_int)
语法正确:swap(c1, deq_int)
list<const char*> c1
语法正确:c1.swap(list_cp)
语法正确:swap(c1, list_cp)
list<const char*> c1
语法错误:c1.swap(list_str)
语法错误:swap(c1, list_str)
list<const char*> c1
语法错误:c1.swap(list_int)
语法错误:swap(c1, list_int)
list<string> c1
语法错误:c1.swap(list_cp)
语法错误:swap(c1, list_cp)
list<string> c1
语法正确:c1.swap(list_str)
语法正确:swap(c1, list_str)
list<string> c1
语法错误:c1.swap(list_int)
语法错误:swap(c1, list_int)
list<int> c1
语法错误:c1.swap(list_cp)
语法错误:swap(c1, list_cp)
list<int> c1
语法错误:c1.swap(list_str)
语法错误:swap(c1, list_str)
list<int> c1
语法正确:c1.swap(list_int)
语法正确:swap(c1, list_int)
array<const char*, 8> c1
语法正确:c1.swap(ary_cp)
语法正确:swap(c1, ary_cp)
array<const char*, 8> c1
语法错误:c1.swap(ary_str)
语法错误:swap(c1, ary_str)
array<const char*, 8> c1
语法错误:c1.swap(ary_int)
语法错误:swap(c1, ary_int)
array<string, 8> c1
语法错误:c1.swap(ary_cp)
语法错误:swap(c1, ary_cp)
array<string, 8> c1
语法正确:c1.swap(ary_str)
语法正确:swap(c1, ary_str)
array<string, 8> c1
语法错误:c1.swap(ary_int)
语法错误:swap(c1, ary_int)
array<int, 8> c1
语法错误:c1.swap(ary_cp)
语法错误:swap(c1, ary_cp)
array<int, 8> c1
语法错误:c1.swap(ary_str)
语法错误:swap(c1, ary_str)
array<int, 8> c1
语法正确:c1.swap(ary_int)
语法正确:swap(c1, ary_int)
forward_list<const char*> c1
语法正确:c1.swap(fl_cp)
语法正确:swap(c1, fl_cp)
forward_list<const char*> c1
语法错误:c1.swap(fl_str)
语法错误:swap(c1, fl_str)
forward_list<const char*> c1
语法错误:c1.swap(fl_int)
语法错误:swap(c1, fl_int)
forward_list<string> c1
语法错误:c1.swap(fl_cp)
语法错误:swap(c1, fl_cp)
forward_list<string> c1
语法正确:c1.swap(fl_str)
语法正确:swap(c1, fl_str)
forward_list<string> c1
语法错误:c1.swap(fl_int)
语法错误:swap(c1, fl_int)
forward_list<int> c1
语法错误:c1.swap(fl_cp)
语法错误:swap(c1, fl_cp)
forward_list<int> c1
语法错误:c1.swap(fl_str)
语法错误:swap(c1, fl_str)
forward_list<int> c1
语法正确:c1.swap(fl_int)
语法正确:swap(c1, fl_int)
--------------------------------------------------------------
**********************assign_and_swap end*************************
**************************add_item start**************************
语法正确:vec_str.push_back(string("str"))
语法正确:deq_str.push_back(string("str"))
语法正确:list_str.push_back(string("str"))
语法正确:vec_str.c.emplace_back("01234", 3)
语法正确:deq_str.c.emplace_back("01234", 3)
语法正确:list_str.c.emplace_back("01234", 3)
语法错误:vec_str.push_front(string("str"))
语法正确:deq_str.push_front(string("str"))
语法正确:list_str.push_front(string("str"))
语法错误:vec_str.c.emplace_front("01234", 3)
语法正确:deq_str.c.emplace_front("01234", 3)
语法正确:list_str.c.emplace_front("01234", 3)
语法正确:vec_str.insert(p, string("str"))
语法正确:deq_str.insert(p, string("str"))
语法正确:list_str.insert(p, string("str"))
语法正确:vec_str.c.emplace(p, "01234", 3)
语法正确:deq_str.c.emplace(p, "01234", 3)
语法正确:list_str.c.emplace(p, "01234", 3)
语法正确:vec_str.insert(p, 2, string("str"))
语法正确:deq_str.insert(p, 2, string("str"))
语法正确:list_str.insert(p, 2, string("str"))
语法正确:vec_str.insert(p, tmp.begin(), tmp.end())
语法正确:deq_str.insert(p, tmp.begin(), tmp.end())
语法正确:list_str.insert(p, tmp.begin(), tmp.end())
语法正确:vec_str.insert(p, {cp_list})
语法正确:deq_str.insert(p, {cp_list})
语法正确:list_str.insert(p, {cp_list})
**************************add_item end****************************
************************access_item start*************************
语法正确:vec_str.back()
语法正确:deq_str.back()
语法正确:list_str.back()
语法正确:ary_str.back()
语法错误:fl_str.back()
语法正确:vec_str.front()
语法正确:deq_str.front()
语法正确:list_str.front()
语法正确:ary_str.front()
语法正确:fl_str.front()
语法正确:vec_str[4]
语法正确:deq_str[4]
语法错误:list_str[4]
语法错误:ary_str[4]
语法错误:fl_str[4]
语法正确:vec_strat(4)
语法正确:deq_strat(4)
语法错误:list_strat(4)
语法错误:ary_strat(4)
语法错误:fl_strat(4)
************************access_item end***************************
************************delete_item start*************************
语法正确:vec_str.pop_back()
语法正确:deq_str.pop_back()
语法正确:list_str.pop_back()
语法错误:ary_str.pop_back()
语法错误:fl_str.pop_back()
语法错误:vec_str.pop_front()
语法正确:deq_str.pop_front()
语法正确:list_str.pop_front()
语法错误:ary_str.pop_front()
语法正确:fl_str.pop_front()
语法正确:vec_str.erase(p)
语法正确:deq_str.erase(p)
语法正确:list_str.erase(p)
语法错误:ary_str.erase(p)
语法错误:fl_str.erase(p)
语法正确:vec_str.erase(b,e)
语法正确:deq_str.erase(b,e)
语法正确:list_str.erase(b,e)
语法错误:ary_str.erase(b,e)
语法错误:fl_str.erase(b,e)
语法正确:vec_str.clear()
语法正确:deq_str.clear()
语法正确:list_str.clear()
语法错误:ary_str.clear()
语法正确:fl_str.clear()
************************delete_item end***************************