4

BOOST_STATIC_ASSERT を使用して、互換性のない型で現在生成されているモンスターよりも単純なコンパイル エラー メッセージで互換性のない型を使用したことをユーザーに知らせることで、テンプレート化されたコードの一部のユーザーを支援したいと考えています。

例はここで再現するには少し複雑すぎますが、うまくいけば、これで私が望むものの本質を捉えることができます:

私の質問は、その最後の行である「テンプレート テンプレート」をどのようにフォーマットするかです。

template <typename P1, int P2, typename P3> 
class InterestingType

{
}

template<typename T>
struct is_interesting_type{
 static const bool value = false;
};

template<template<typename,int,typename> typename InterestingType> //No idea how to format this..
struct is_interesting_type{
 static const bool value = true;
};
4

1 に答える 1

3

コードを次のように変更します

template <typename P1, int P2, typename P3> 
struct is_interesting_type<InterestingType<P1, P2, P3> >{
 static const bool value = true;
};
于 2010-06-23T05:03:46.697 に答える