help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

for "vector<int,allocator<int> > vx; " must I erase using something li


From: Leland T. Snyder
Subject: for "vector<int,allocator<int> > vx; " must I erase using something like "vx.erase(vx.begin()+2); " or may the "at" command be somehow used? "vx.erase(vx.at(2)); "
Date: Thu, 29 Apr 2004 18:36:42 GMT

This must be either a change in the ISO standard, or a variance in the way
GNU g++ treats vector::at becuase this is an example that use to work (in
another C++ compiler).
Is the convention now to only refererence using and increment from begin?
I'd look this up in a manual if it wern't for the fact that "at" is such a
common word it becomes utterly unsearchable.

I know this is symantics and either was is just as terse, just want some
clarification.

I'm sure posting the compile error message is overkill here.

vector.C:98: error: no matching function for call to `std::vector<int,
   std::allocator<int> >::erase(int&)'
/usr/include/g++/bits/vector.tcc:105: error: candidates are:
   __gnu_cxx::__normal_iterator<_Tp*, std::vector<_Tp, _Alloc> >
   std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<_Tp*,
   std::vector<_Tp, _Alloc> >) [with _Tp = int, _Alloc =
std::allocator<int>]
/usr/include/g++/bits/vector.tcc:117: error:
   __gnu_cxx::__normal_iterator<_Tp*, std::vector<_Tp, _Alloc> >
   std::vector<_Tp, _Alloc>::erase(__gnu_cxx::__normal_iterator<_Tp*,
   std::vector<_Tp, _Alloc> >, __gnu_cxx::__normal_iterator<_Tp*,
   std::vector<_Tp, _Alloc> >) [with _Tp = int, _Alloc =
std::allocator<int>]
-bash: ./vector: No such file or directory




reply via email to

[Prev in Thread] Current Thread [Next in Thread]