This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Possible accept wrong code in C++?


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?

I'll try mainline and 4.1 when I get back home.

Ed Smith-Rowland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]