72 static int instanceCnt;
74 N (uint x = rand() % (abs(n)+1))
90 std::swap (i_, rr.i_);
95 N& operator= (
N const&) =
default;
96 N& operator= (
N&&) =
default;
98 operator string()
const 100 static _Fmt format{
"%s──%s─"};
101 return format %
typeStr(*
this) % i_;
103 friend bool operator== (
N const& l,
N const& r) {
return l.i_ == r.i_; }
104 friend bool operator!= (
N const& l,
N const& r) {
return l.i_ != r.i_; }
114 template<
class...ARGS>
118 static _Fmt format{
"%2d╎%s┤"};
119 return format %
sizeof...(ARGS) % join({toString(args)...},
"┼");
142 check_reorderedArguments();
144 CHECK (0 == N<0>::instanceCnt);
145 CHECK (0 == N<1>::instanceCnt);
146 CHECK (0 == N<2>::instanceCnt);
147 CHECK (0 == N<3>::instanceCnt);
154 CHECK (0 == N<0>::instanceCnt);
155 CHECK (0 == N<1>::instanceCnt);
156 CHECK (0 == N<2>::instanceCnt);
157 CHECK (0 == N<3>::instanceCnt);
163 cout <<
fun (n1,n2,n3,nn) << endl;
165 CHECK (0 == N<0>::instanceCnt);
166 CHECK (1 == N<1>::instanceCnt);
167 CHECK (1 == N<2>::instanceCnt);
168 CHECK (2 == N<3>::instanceCnt);
171 CHECK (0 == N<0>::instanceCnt);
172 CHECK (0 == N<1>::instanceCnt);
173 CHECK (0 == N<2>::instanceCnt);
174 CHECK (0 == N<3>::instanceCnt);
185 CHECK (n1 == pickArg<0> (n1,n2,n3));
186 CHECK (n2 == pickArg<1> (n1,n2,n3));
187 CHECK (n3 == pickArg<2> (n1,n2,n3));
193 CHECK (n0 != pickArg<0> (N<0>{23}));
194 CHECK (n0 == pickArg<0> (N<0>{n0}));
205 CHECK (1 == (pickInit<0,int> (1,2) ));
206 CHECK (2 == (pickInit<1,int> (1,2) ));
207 CHECK (0 == (pickInit<2,int> (1,2) ));
209 CHECK (n1 == (pickInit<0,N0> (n1,n2) ));
210 CHECK (n2 == (pickInit<1,N0> (n1,n2) ));
212 CHECK (
"N<0>" ==
typeStr(pickInit<3,N0> (n1,n2)));
213 CHECK (
"N<0>" ==
typeStr(pickInit<3,N0> (1,
"2")));
214 CHECK (
"N<0>" ==
typeStr(pickInit<3,N0> ()));
236 template<
class...ARGS,
size_t...idx>
240 return fun (pickArg<idx> (forward<ARGS>(args)...) ...);
252 cout <<
fun (n0,n1,n2,n3) << endl;
254 using Backwards =
typename BuildIndexSeq<4>::Descending;
255 using Back2 =
typename BuildIndexSeq<2>::Descending;
256 using After2 =
typename BuildIndexSeq<4>::After<2>;
258 cout << call_with_reversed_arguments (Backwards(), n0,n1,n2,n3) <<endl;
259 cout << call_with_reversed_arguments (Back2() , n0,n1,n2,n3) <<endl;
260 cout << call_with_reversed_arguments (After2() , n0,n1,n2,n3) <<endl;
bool operator==(PtrDerefIter< I1 > const &il, PtrDerefIter< I2 > const &ir)
Supporting equality comparisons...
A front-end for using printf-style formatting.
Implementation namespace for support and library code.
Simple test class runner.
Metaprogramming with type sequences based on variadic template parameters.