Error using traits class.: "expected constructor destructor or type conversion before '&' token"

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-03-24T20:46:57Z Indexed on 2010/03/24 21:03 UTC
Read the original article Hit count: 554

Filed under:
|
|
|

I have a traits class that's used for printing out different character types:

template <typename T>
class traits {
public:
    static std::basic_ostream<T>& tout;
};
template<>
std::ostream& traits<char>::tout = std::cout;
template<>
std::wostream& traits<unsigned short>::tout = std::wcout;

gcc (g++) version 3.4.5 (yes somewhat old) is throwing an error: "expected constructor destructor or type conversion before '&' token"

And I'm wondering if there's a good way to resolve this.

(it's also angry about _O_WTEXT so if anyone's got some insight into that, I'd also appreciate it)

© Stack Overflow or respective owner

Related posts about c++

Related posts about traits