Hi,
In the code snippet below, I am trying to read the contents of a file
into a vector. However I can't get it compiled. I am using Sunstudio
which compiles C++ using cc.
Here is the code:
#include <fstream>
#include <vector>
int main( int argc, char ** argv )
{
std::ifstream input( "input.txt" );
std::istream_it erator<intdataB egin( input );
std::istream_it erator<intdataE nd;
std::vector<int v( dataBegin, dataEnd ); //Compiler error
return (EXIT_SUCCESS);
}
Compiler error: Could not find a match for
std::vector<int >::vector(std:: istream_iterato r<int, char,
std::char_trait s<char>, int>, std::istream_it erator<int, char,
std::char_trait s<char>, int) needed in main(int, char**);
Comment