C ++では、次のようなテンプレートテンプレートパラメータを使用できます。
template <template <bool> class T>
struct something1 {};
ブール型はtypedefに置き換えることができます(したがって、元の型名が宣言に表示される必要はありません)。
typedef bool bool_t;
template <template <bool_t> class T>
struct something2 {};
これは完全に機能しますが、次のようにネストされた構造を定義しようとすると、次のようになります。
template <typename Type>
struct enclosing
{
typedef bool bool_t;
typedef Type type_t;
template <template <bool_t> class T>
struct something3 {};
template <template <type_t> class T>
struct something4 {};
};
次に、次のコードはコンパイルに失敗します。
template <bool Value>
struct param {};
typedef something1<param> x1; // ok
typedef something2<param> x2; // ok
typedef enclosing<bool>::something3<param> x3; // ok
typedef enclosing<bool>::something4<param> x4; // error
これは標準に準拠した動作ですか、それとも私は何か間違ったことをしていますか?私はMSVS2008を使用しています。
編集:
マイクロソフトのサポートフォーラムにバグレポートを投稿しました:
バグレポート