STLのベクトルテンプレート引数のテンプレートを特殊化したいと考えています。このようなもの:is_stl_vectorの実装方法
// (1)
template <typename T>
class A
{
...
};
// (2)
template <>
class A<std::vector<> >
{
...
};
どのようなベクトル要素の種類は気にしません。一般的に
A<int> a1; // Will use the general specialization
A<std::vector<int> > a2; // Will use the second specialization
を私はブーストのタイプの特徴に似た何かを定義しようとしてきた:私は次のようにそれを使用したいと思います。それはあまりにも非テンプレートタイプ用にコンパイルする必要があるため
template <class T>
struct is_stl_vector
{
// Will be true if T is a vector, false otherwise
static const bool value = ...;
};
のようなものは、私は(私はそう思う)テンプレートテンプレートを使用することはできません。まったく可能ですか?
'のstd :: vector'は、C++標準ライブラリではなく、STLからです。 –
@トマラク:何ですか? 'std :: vector'はSTLからのものではありませんか? STLとは何ですか? – Nawaz
@Tomalak: 'std :: vector'は、[STL](http://en.wikipedia.org/wiki/Standard_Template_Library)の一部としてC++標準ライブラリに含まれています。それは実際には両方からです。 –