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]

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


>>>>> "Andrew" == Andrew Guts <andr@fe-club.net> writes:

    Andrew> Hello All.  So nobody wants to help me?

    Andrew> Thanks anyway

There simply just is no implementation of vector<>::at(size_t) in
libstdc++-2.x.

But you can get around this easily. Either install a new version or
just use the [] operator (check the index range manually beforehand if
you need to).

Claudio

    Andrew> Andrew Guts wrote:

    >> 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

-- 
Yes, God had a deadline. So he wrote it all in Lisp.


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