I have a vector, I want to sort it. When I try to compile I get this error (abbr):
error C2664: '()' : cannot convert parameter 1 from 'class ModeInfo *' to 'class ModeInfo &'
see reference to function template instantiation 'void __cdecl std::_Unguarded_insert(class ModeInfo ** ,class ModeInfo *,struct modeSort)' being compiled
The call is made as such; m_modeList is declared; MODE_VECTOR is defined as:
typedef std::vector<ModeInfo *> MODE_VECTOR
MODE_VECTOR m_modeList;
std::sort( m_modeList.begin(), m_modeList.end(), modeSort() );
if the ModeInfo class is needed let me know and i'll post it - I didn't want to waste a lot of space displaying the declaration.
Current troubleshooting:
What bothers me is that the first term is the issue - the SGI guide for stl states that vector.begin() and vector.end() both return a const_iterator ( just pointing to different elements ). MSDN documentation reflects the same information - in fact sample code is shown using std::sort( eg.begin(), eg.end() ). That example sort just uses a "less than" instead of the binary_function but the terms in question are prototyped the same so this error makes no sense.
Algorthm.h is as follows (formatted):
template<class _RI, class _Ty, class _Pr> inline
void _Sort_0(_RI _F, _RI _L, _Pr _P, _Ty *)
{
if (_L - _F <= _SORT_MAX)
_Insertion_sort(_F, _L, _P);
else
{_Sort(_F, _L, _P, (_Ty *)0);
_Insertion_sort(_F, _F + _SORT_MAX, _P);
for (_F += _SORT_MAX; _F != _L; ++_F)
_Unguarded_insert(_F, _Ty(*_F), _P);
}
}
if I was a betting man then I'd say that either the documentation was hosed, the SGI implementation is slightly different, or the _Unguarded_insert call is wrong.
I am getting to like STL but am by no means an expert - thank you in advance for a solution or just a direction to help me figure this out. Sorry this post is a little lenghty..
#dth-0
[edited by - xiuhcoatl on May 1, 2002 1:14:15 AM]
[edited by - xiuhcoatl on May 1, 2002 1:20:03 AM]
[edited by - xiuhcoatl on May 1, 2002 1:21:00 AM]
[edited by - xiuhcoatl on May 1, 2002 1:21:51 AM]
[edited by - xiuhcoatl on May 1, 2002 1:24:38 AM]
"C and C++ programmers seem to think that the shortest distance between two points is the great circle route on a spherical distortion of Euclidean space."Stephen Dewhurst