Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
Hello world!
cppPyEnum
ncr
role of copy constructor
ABC.cpp
typeid
Matrix multiplication naive approach
Anagrams WIP
Hi
Dar