Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
mutable constexpr
#include <iostream> template<int N> struct flag { friend constexpr int adl_flag (flag<N>); }; template<int N> struct writer { friend constexpr int adl_flag (flag<N>) { return N; } static constexpr int value = N; }; template<int N, int = adl_flag (flag<N> {})> int constexpr reader (int, flag<N>) { return N; } template<int N> int constexpr reader (float, flag<N>, int R = reader (0, flag<N-1> {})) { return R; } int constexpr reader (float, flag<0>) { return 0; } template<int N = 1> int constexpr next (int R = writer<reader (0, flag<32> {}) + N>::value) { return R; } int main() { constexpr int a = next(); constexpr int b = next(); constexpr int c = next(); std::cout << "a = " << a << std::endl; std::cout << "b = " << b << std::endl; std::cout << "c = " << c << std::endl; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
FindMissingLagrange
0-1 Knapsack
Inherit
c++ mouse
runtime template mode processor
infix to postfix v 5.0 (with exponent support)
strange builtin_offseof behavior
at.cpp
Cuantos dedos
SIP_parser_with_std_regex_need_help_to_improve_it.cc
stackse - search stackoverflow differently
Please log in to post a comment.