glen wrote:
> template<typename C>
> std::ostream& operator<< (std::ostream& op, const C& cpi )
> {
> typename C::const_iterator start( cpi.begin() );
> typename C::const_iterator end( --(cpi.end() ));
> typename C::const_iterator iter;
> op << "{";
> for (iter=start;iter!=end; ++iter){
> op<<*iter<<",";
> }
> op<<*iter<<"}";
> return op;
> };
>
> The offending lines are the
> op<<"{";
> and
> op<<"}";
Several things:
- You didn't provide a minimal example.
- You didn't provide the errormessage.
- The last semicolon is wrong.
- Your indentation is inconsistent, making it harder for the reader.
- Your code invokes undefined behaviour on an empty container.
> apparently it doesn't know what to do with a simple string
Well, anyways, your operator's signature matches _EVERYTHING_, including a
character literal.
Uli
--
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus