- C++相談室 part112
475 :デフォルトの名無しさん[sage]:2014/05/11(日) 05:04:56.15 ID:qTKGEVW0 - こういう手もあるな
#include <iostream> template<class U, size_t N> class int_to_type { static const U _N = N; }; struct hoge { template <class U, size_t N> int operator ()(int_to_type<U, N>) { std::cout << N << std::endl; return 0; } }; int main() { // your code goes here hoge Hoge; Hoge(int_to_type<size_t, 2ull>()); Hoge(int_to_type<int, 2>()); }
|
|