Hi,
when I want to compile the below i get an error like
no matching function for call to ...
from g++
Code:#include <iostream> #include <fstream> #include <vector> template< class T > inline void write_binary( const T& _t, std::ofstream& out ) { out.write( (char*)(&_t), sizeof(T) ); } struct foo { int n; void write_binary( std::ofstream& f ) const; }; void foo::write_binary( std::ofstream& f ) const { write_binary( n, f ); } int main(){ foo f; std::ofstream ofile("file.tss"); f.write_binary( ofile ); }




Reply With Quote
