This won't work in VC++6:
I get the error:Code:#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { const int size = 3; char myArray[size] = {'y', 'e', 's'}; string str; copy(myArray, myArray + size, back_inserter(str)); cout<<str<<endl; return 0; };
back_inserter() calls push_back() for the container, and the string class has a push_back() member function, so is that a compiler bug, or am I doing something wrong?error C2039: 'push_back' : is not a member of 'basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
c:\program files\c++microsoft visual studio\vc98\include\iterator(82) : while compiling class-template member function 'class std::back_insert_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >
&__thiscall std::back_insert_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::operator =(const char &)'
Error executing cl.exe.



LinkBack URL
About LinkBacks



CornedBee