13#include <bits/stdc++.h>
30 struct point {
int x, y; };
40 point gpp_ext = { .x = 1 };
42 point gcc_ext = { x: 1 };
46 struct struct_with_mutable {
47 struct_with_mutable(){};
49 }
const const_struct_with_mutable;
50 const_struct_with_mutable.m = 2;
51 assert(const_struct_with_mutable.m == 2);
69 assert(*s.find(1) == 1);
70 assert(s.find(3) == s.end());
74 m.insert(make_pair(
'b', 2));
78 multimap <char, int> mm;
79 mm.insert(make_pair(
'c', 1));
80 mm.insert(make_pair(
'b', 2));
81 mm.insert(make_pair(
'a', 3));
82 mm.insert(make_pair(
'a', 4));
83 multimap<char,int>::iterator i = mm.find(
'a');
84 assert(i->second == 3);
86 assert(i->second == 4);
88 assert(i->first ==
'b');
89 assert(i->second == 2);
96 assert(c.max_size() > 1000);
98 assert(c.front() == 0);
99 assert(c.back() == 0);
100 assert(c.size() == 1);
105 assert(c.size() == 4);
115 }
catch (out_of_range
const& exc) {
118 assert(err.length());
122 int arr[] = {1, 2, 3};
123 v.insert(v.begin(), arr, arr+3);
140 assert(v.capacity() == 10);
148 assert(s.top() == 1);
150 assert(s.top() == 2);
152 assert(s.top() == 1);
159 assert(q.front() == 1);
160 assert(q.back() == 2);
162 assert(q.front() == 2);
177bool func(
int i,
int j) {
return i < j; }
181 bool operator() (
int i,
int j) {
return i < j; }
186 int a[] = {5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
187 vector<int> v (a, a +
sizeof a /
sizeof a[0]);
190 sort(v.begin(), v.begin()+4);
193 sort(v.begin() + 4, v.end(), func);
196 sort(v.begin(), v.end(), greater<int>());
199 sort (v.begin(), v.end(), functor);
202 for (vector<int>::iterator i=v.begin(); i != v.end(); ++i) {
227 assert(
typeid(
int) ==
typeid(a));
228 assert(
typeid(
int).name() ==
string(
"i"));
234 assert(d.Virtual_A::n == 3);
235 assert(d.Virtual_B::n == 3);
242 assert(__cplusplus == 199711);
248 assert(min(1,2) == 1);
249 assert(max(1,2) == 2);
250 pair<int, char> p(1,
'a');
251 assert(p.first == 1);
252 assert(p.second ==
'a');
253 p = make_pair(
'b', 2);
254 assert(p.first ==
'b');
void test_vector_container(V &v)
int & a_ref(int &a)
https://en.cppreference.com/w/cpp/language/reference
void test_generic_container(C &c)
void container_03()
container
void associative_containers_03()