But I can see that you're passing your vector by const ref :-)
you need to use a const_iterator
vector<int>::const_iterator it;
Andy
P.S. It would be better C++ style to use
vector<int>::const_iterator it = find(customer.begin(), customer.end(), this_customer);
In your case, the iterator's default constructor is called, and then its operator=
In the case I've just given, just the assignment constructor is triggered. (Class obj = val; and Class obj(val); are the same in this respect. The latter form is less readable in this case (for me) as the instance name is so much smaller than the find(..) expression.
Thanks. I made that change, but it still errors out. I didn't post the error because it's very long and cryptic (to me, at least). Here it is, in all its glory:
main.cpp|213|error: no matching function for call to 'find(__gnu_cxx::__normal_iterator<const int*, std::vector<int, std::allocator<int> > >, __gnu_cxx::__normal_iterator<const int*, std::vector<int, std::allocator<int> > >, unsigned int&)'|
Maybe this will make sense to you? Thanks for your help!
Thanks. As a C++ beginner, how would I know to look for this? I looked at the iterator reference page on this site, and I see no mention of needing the algorithm header. This is the kind of stuff that makes me crazy about learning C++, so I'm obviously trying to make this process less frustrating.
Any advice is appreciated. Thanks again for catching that.
The error messages produced for template problems aren't as bad as they used to be, but they are rather arcane. But you soon learn to spot the key bits!