0
基本的な型を含むstd :: vectorのクラステンプレートを部分的に特殊化したいと思います。基本クラスのstd :: vectorの部分クラステンプレートの特殊化
私のアプローチは、このように見えますが、does not compile
#include <type_traits>
#include <vector>
#include <string>
#include <iostream>
template <typename T, bool bar = false>
struct foo {
static void show()
{
std::cout << "T" << std::endl;
}
};
template <typename T>
struct foo<typename std::enable_if<std::is_fundamental<T>::value, std::vector<T>>::type, false> {
static void show()
{
std::cout << "std::vector<fundamental type>" << std::endl;
}
};
template <typename T>
struct foo<std::vector<T>, false> {
static void show()
{
std::cout << "std::vector<T>" << std::endl;
}
};
int main()
{
foo<int>::show();
foo<std::vector<int>>::show();
foo<std::vector<std::string>>::show();
}
は、どのように私はそれを動作させることができますか?