【C++】template 統合スレ -- Part6at TECH【C++】template 統合スレ -- Part6 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト800:デフォルトの名無しさん 05/08/07 16:48:53 template<class A> struct Foo { template<class B> struct Bar { }; }; このBarだけを特殊化するのって、GCCでは template<>template<> struct Foo<int>::Bar<int> って書かなきゃならないんだね。 VC++7.1では template<> struct Foo<int>::Bar<int> で通るんだけど、これはバグなのかな? 801:デフォルトの名無しさん 05/08/07 16:55:26 >>800 どっちが規格に準じてるかによるね 802:デフォルトの名無しさん 05/08/07 17:00:26 >>800 14.7.3.17 より "If the declaration of an explicit specialization for such a member appears in namespace scope, the member declaration shall be preceded by a template<> for each enclosing class template that is explicitly specialized." template<> template<> ... と繰り返すのが正解っぽい。 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch