On 2/22/06, Ed Smith-Rowland <[EMAIL PROTECTED]> wrote: > All, > > I have a template class: > > template < class Datum, unsigned long Dim > > class DataGrid > { > ... > public: > ... > std::ostream & write( std::ostream & output ) const; > ... > }; > > I have a non-member operator overload: > > On GCC-3.4 Cygwin I needed: > > template < class Datum, unsigned long Dim > > inline std::ostream & operator<<( std::ostream & output, const > DataGrid<Datum,Dim> & data_grid ) > { > return data_grid.write( output ); > } > > On GCC-4.0 MacOSX I was able to get by with this: > > inline std::ostream & operator<<( std::ostream & output, const DataGrid > & data_grid ) > { > return data_grid.write( output ); > } > > I actually think that 3.4 is right!!! > Am I wrong? >
No, gcc version 4.0.2 20051125 (Red Hat 4.0.2-8) does not recognize DataGrid as a type in the operator<< function definition as expected. To be honest I have no idea why/how your OSX 4.0 compiler comprehends this...? -- Tarjei