63 static int instanceCnt;
65 N (uint x =
rani(1 + abs(n)))
81 std::swap (i_, rr.i_);
86 N& operator= (
N const&) =
default;
87 N& operator= (
N&&) =
default;
89 operator string()
const 91 static _Fmt format{
"%s──%s─"};
92 return format %
typeStr(*
this) % i_;
94 friend bool operator== (
N const& l,
N const& r) {
return l.i_ == r.i_; }
95 friend bool operator!= (
N const& l,
N const& r) {
return l.i_ != r.i_; }
105 template<
class...ARGS>
109 static _Fmt format{
"%2d╎%s┤"};
110 return format %
sizeof...(ARGS) % join({toString(args)...},
"┼");
134 check_reorderedArguments();
136 CHECK (0 == N<0>::instanceCnt);
137 CHECK (0 == N<1>::instanceCnt);
138 CHECK (0 == N<2>::instanceCnt);
139 CHECK (0 == N<3>::instanceCnt);
146 CHECK (0 == N<0>::instanceCnt);
147 CHECK (0 == N<1>::instanceCnt);
148 CHECK (0 == N<2>::instanceCnt);
149 CHECK (0 == N<3>::instanceCnt);
155 cout <<
fun (n1,n2,n3,nn) << endl;
157 CHECK (0 == N<0>::instanceCnt);
158 CHECK (1 == N<1>::instanceCnt);
159 CHECK (1 == N<2>::instanceCnt);
160 CHECK (2 == N<3>::instanceCnt);
163 CHECK (0 == N<0>::instanceCnt);
164 CHECK (0 == N<1>::instanceCnt);
165 CHECK (0 == N<2>::instanceCnt);
166 CHECK (0 == N<3>::instanceCnt);
177 CHECK (n1 == pickArg<0> (n1,n2,n3));
178 CHECK (n2 == pickArg<1> (n1,n2,n3));
179 CHECK (n3 == pickArg<2> (n1,n2,n3));
185 CHECK (n0 != pickArg<0> (N<0>{23}));
186 CHECK (n0 == pickArg<0> (N<0>{n0}));
197 CHECK (1 == (pickInit<0,int> (1,2) ));
198 CHECK (2 == (pickInit<1,int> (1,2) ));
199 CHECK (0 == (pickInit<2,int> (1,2) ));
201 CHECK (n1 == (pickInit<0,N0> (n1,n2) ));
202 CHECK (n2 == (pickInit<1,N0> (n1,n2) ));
204 CHECK (
"N<0>" ==
typeStr(pickInit<3,N0> (n1,n2)));
205 CHECK (
"N<0>" ==
typeStr(pickInit<3,N0> (1,
"2")));
206 CHECK (
"N<0>" ==
typeStr(pickInit<3,N0> ()));
228 template<
class...ARGS,
size_t...idx>
232 return fun (pickArg<idx> (forward<ARGS>(args)...) ...);
244 cout <<
fun (n0,n1,n2,n3) << endl;
246 using Backwards =
typename BuildIndexSeq<4>::Descending;
247 using Back2 =
typename BuildIndexSeq<2>::Descending;
248 using After2 =
typename BuildIndexSeq<4>::After<2>;
250 cout << call_with_reversed_arguments (Backwards(), n0,n1,n2,n3) <<endl;
251 cout << call_with_reversed_arguments (Back2() , n0,n1,n2,n3) <<endl;
252 cout << call_with_reversed_arguments (After2() , n0,n1,n2,n3) <<endl;
int rani(uint bound=_iBOUND())
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.
Simplistic test class runner.
Metaprogramming with type sequences based on variadic template parameters.