What's wrong with vector<>::at(int) ?

Andrew Guts andr@fe-club.net
Mon Oct 29 03:40:00 GMT 2001


Such code was compiled well with VC++. What's wrong for gcc ?

class Item {};

class My {
protected:
   vector <Item> item;
...
public:
...
   const Item& getitem(int i) const {  return item.at(i); }

}


d.cpp: In method `const class ::d::cField & ::d::My::getitem(int)
const':
d.cpp:791: no matching function for call to
`vector<::d::Item,allocator<::d::Item> >
::at (int &) const'

Thanks

Andrew




More information about the Gcc-help mailing list