Lazy K on C++ Template
struct K { template<typename T> struct apply { struct type { template<typename U> struct apply { typedef T type; }; }; }; }; struct S { template<typename T> struct apply { struct type { template<typename U> struct apply { struct type { template<typename V> struct apply { typedef typename T::template apply<V>::type::apply<typename U::template apply<V>::type>::type type; }; }; }; }; }; }; struct I { template<typename T> struct apply { typedef T type; }; }; using boost::enable_if; using boost::is_same; enable_if< is_same< K::apply<I>::type::apply<I>::type, S::apply<K>::type::apply<K>::type::apply<I>::type>::type, int>::type a;
templateで書いたら簡単なんだが、普通にC++でいわれると面倒になるなぁ。それにしてももうちょっと短くならんもんか。