Q&Aサイトにあった質問にここで密かに答える。
http://okwave.jp/qa4126119.html
template <typename T, T N> struct inttype { typedef T type; static const T value= N; }; template <std::size_t DIM> class Component { public: template <class ...ARGS> Component(ARGS... args) :Component(inttype<std::size_t, 0>(), args...){} template <class I, I M, class U, class ...ARGS> Component(inttype<I, M> n, const U& argn, ARGS... args) :Component(inttype<typename inttype<I, M>::type, inttype<I, M>::value+1>(), args...) { x[inttype<I, M>::value] = argn; } template <class I, I M, class U> Component(inttype<I, M> n, const U& argn) { static_assert(inttype<I, M>::value < DIM, "引数多過ぎ"); x[inttype<I, M>::value] = argn; } double x[DIM]; };
こんな、C++0xの新機能を使った回答をおおっぴらにすることはでけん。