Hi.

Don't know if this is a compiler issue, or a problem with my code. 
The code below compiles fine under vc++, but I'm having trouble 
using gcc.  It's just a templated container output.


  /**
  outputs elements of a vector in the form '{el1,el2...elEnd}'
  */
  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<<"}";

apparently it doesn't know what to do with a simple string, but it can
handle the template argument...  Is this a compiler problem (gcc version
4.1.1, on redhat fc 5)?  Or is it a subtlety of templates and the standard
that I don't quite get?

I appreciate any assistance that can be given.  Searched the web but was
unable to find anything that helped.

Glen
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to