This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

explicit specialization in non-namespace scope


> I am using gcc 3.1 compiler for power pc. I am getting the following
> errors if I specialize member templates.
> 
> TEST_Stream_accessor.h:22: explicit specialization in non-namespace scope
> `class TEST::Stream_accessor'
> TEST_Stream_accessor.h:23: invalid use of undefined type `class
> TEST::Stream_accessor'
> TEST_Stream_accessor.h:9: forward declaration of `class
> TEST::Stream_accessor'
> TEST_Stream_accessor.h:24: confused by earlier errors, bailing out
> 
> Code Used:
> 
> namespace TEST
> {
>    class Stream_accessor
>    {
>    public:
>       Stream_accessor();
>       virtual ~Stream_accessor();
> 
>       template < class Stream >
>       static void create_stream(Stream * * stream_ptr)
>       {}
> 
>       template < >
>       static void create_stream  < std::istringstream >
> (std::istringstream * * stream_ptr)
>       {
>          * stream_ptr = new std::istringstream();
>       }
>    };
> }
> 
> I am getting "is not a valid type for a template constant parameter"  if I
> use the following syntax:
> 
>       template < std::istringstream >
>       static void create_stream (std::istringstream * * stream_ptr)
>       {
>          * stream_ptr = new std::istringstream();
>       }
> 
> 'struct std::basic_istringstream<char, std::char_traits<char>,
> std::allocator<char> >' is not a valid type for a template constant
> parameter
> `struct std::basic_ostringstream<char, std::char_traits<char>,
> std::allocator<char> >' is not a valid type for a template constant
> parameter
> `struct std::basic_ifstream<char, std::char_traits<char> >' is not a valid
> type for a template constant parameter
> `struct std::basic_ofstream<char, std::char_traits<char> >' is not a valid
> type for a template constant parameter
> 
> Please tell me as to what the syntax should be to implement
> specializations for member templates ( The first method works fine with
> MSVC compiler )
> 
> Thanks,
> Sujatha


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]