境界に基づいて型宣言を作成しようとしています
template<class B>
struct IntDecl {
enum {
L = B::_l, U = B::_u
};
#if (L >=0 && U <=255)
typedef char Type;
#elif (L>=0&&U<=65535)
typedef unsigned int Type;
#endif
};
したがって、ここに示すように、の値に応じてL、U型が定義されます。例えば
IntDecl< BOUND < 0, 65535 > >::Type i; // this should be a unsigned int
IntDecl< BOUND < 0, 255 > >::Type i1; // this should be a char
問題は、 (iとi1) の両方が考慮されることです。charsつまり、#elifが破棄されます。助けはありますか?なぜ#elif実行していないのですか?