Re: CArray help
Ok I understand that ok. So if I don't put the
using namespace::std
I must always prepend the std:: as in
std::vector<int> array(size);
However in my current project if I take out the using namespace std::
I still get an error even with the std:: prepened on one of them.
I have above the class implementation in my view class
#include <vector>
#include <iostream>
and then in the button handler implementation I have
size_t size = 10;
std::vector<int> array(size);
for (size_t i = 0; i < size; i++)
{
array[i] = i; // this goes ok with no error
}
for (size_t j = 0; j < size; j++)
{
cout << array[j] << endl; //error C2065: 'cout' : undeclared identifier
}
std::vector<int> v(2); // these last 3 also compile ok
int& first = v.front();
int& last = v.back();
//// I get the one error shown on the line above. But I can put back the
using namespace std; and also take out the prepended std:: of the two
vectors and it then compiles with no errors and no warnings.