At 01:38 PM 2/29/00 -0800, you wrote:
>(Using NT 4.0, CW R6, compiler version 2.3.1, __MWERKS__ == 0x2301)
>
>I'm writing a stream class.  It includes a member function template to
>generically support writing out objects of any type.  It looks like this
>(simplified for illustration) --
>
>    struct ObjectStream
>    {
>        template <class T>
>        void WriteObject( const T & obj ) { /* ...do stuff... */ }
>    };
>
>This works, PROVIDED that the member template body is defined inside the
>class declaration.  But I want to move it down outside the class body, for
>readability and compliance with our coding standards.  I believe the syntax
>outside the class is supposed to be something like this:
>
>    template <class T>
>    void ObjectStream::WriteObject( const T & obj ) { /* ... */ }
>

Try:

template <class T> void WriteObject(const T& obj)
{
        // blah blah
}

ObjectStream is not a class, it's a structure - you don't need to provide
the namespace, it's in the global one.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to