This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]