【C++】template 統合スレ -- STL/Boost/Loki, etc.
レス数が950を超えています。1000を超えると書き込みができなくなります。
0958957
NGNGやっぱ上のじゃ不便だな、ってことで以下...
template <int N> struct foo {
template <class T> static void baka(const T& t) { //hogehoge }
};
template <> struct foo<1> {
template <class T> static void baka(const std::vector<T>& t) { //hogehoge }
};
template <class T> char hage(const std::vector<T>& t);
double hage(...);
template<typename T>
static void Hoge(const T& t) { foo<sizeof(hage(t))>::baka(t); }
void test() {
int a = 3;
std::vector<int> v(8);
Hoge(a);
Hoge(v);
}
ちゃんとディスパッチできたよ。
sizeof(char) < sizeof(double) だと規格のどこに書いてあるのか小一時間(略
レス数が950を超えています。1000を超えると書き込みができなくなります。