I cannot get the following stringstreamm to compile
stringstream qss;
qss.operator << "some text " ::stringstream.operator << DDateTime::date2Oracle(dFrom) ::stringstream.operator << " more text " ::stringstream.operator << DDateTime::date2Oracle(dUntil);
If I just use the << operator without the ::stringstream.operatorit complains about the operator being ambigious, now it complains about incorrect syntax…
error C2143: syntax error : missing ';' before 'std::stringstream'
EDIT:
error C2593: ‘operator <<‘ is ambiguous
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\ostream(434): could be ‘std::basic_ostream<_Elem,_Traits>::_Myt &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ostream<_Elem,_Traits>::_Mysb *)’
with
[
_Elem=char,
_Traits=std::char_traits
]
Well, it is obvious that whatever type
DDateTime::date2Oracle(dFrom)returns does not implement<<operator. So you will have to write one yourself.As for the syntax, first of all you have to call it just like a function which it actually is:
And second of all,
stringstreamdefined instdnamespace, so you have to write it likestd::stringstreamor::std::stringstream.::stringstreamwill look for it in global namespace and there is no such class defined there.BTW,
operator<<usually is implemented as free function, soqss.operator<<wouldn’t work.