On Saturday 12 February 2005 03:52 am, Michael Stevens wrote:
This is an error because 'vector<unsigned int>()' is a temporary and you can only pass temporaries to 'const' reference parameters. Your function must be declared func(const vector<unsigned int>& foo); OR func(vector<unsigned int> foo); to work with temporaries.
This does allow it to compile, however, once inside the function, I can't use the std::find function because STL doesn't seem to like const iterators...
here is the error I get /usr/include/g++/bits/stl_iterator.h: In constructor ` __gnu_cxx::__normal_iterator<_Iterator, _Container>::__normal_iterator(const __gnu_cxx::__normal_iterator<_Iter, _Container>&) [with _Iter = const unsigned int*, _Iterator = unsigned int*, _Container = std::vector<unsigned int, std::allocator<unsigned int> >]':
/usr/include/g++/bits/stl_iterator.h:598: error: invalid conversion from `const unsigned int* const' to `unsigned int*'