template <typename T>
struct A
{
template <typename U>
struct B;
template <>
struct B<int> {static const int tag = 1;}; // Works fine in VS2010
};
どうすれば B を同じように特殊化できますが、A の外で行うことができます。これを試してみましたが成功しませんでした。
template <typename T> template <>
struct A<T>::B<int> {static const int tag = 1;};
私は得る:
error C3212: 'A<T>::B<int>' : an explicit specialization of a template member must be a member of an explicit specialization
クラス内で定義することで正確にそれを行うことができるので、意味がありません
VS2010の問題?間違った構文?
ありがとう
PS:これは(とにかく間違っているはずです、VS2010をクラッシュさせます):
template <> template <typename T>
struct A<T>::B<int> {static const int tag = 1;};