This is the mail archive of the gcc-prs@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]
Other format: [Raw text]

Re: libstdc++/7974: cannot reference an element of a vector in a class object from an iterator for a vector of such objects (the -> operator fails)


Synopsis: cannot reference an element of a vector in a class object from an iterator for a vector of such objects (the -> operator fails)

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Thu Oct 31 12:39:09 2002
Responsible-Changed-Why:
    Triaged.
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Thu Oct 31 12:39:09 2002
State-Changed-Why:
    User error.
    In test::init you need 'resize' NOT 'reserve': only the former changes the size of the vector, whereas the latter
    its capacity. Definitely, before *assigning* the elements
    of the vector you need it to have two elements, *not* just
    having it allocated raw memory capacity  to grow to a
    maximum size of two without reallocations.
    I suggest reading C++PLSE, §16.3.8.
    
    Thanks for your report, Paolo. 

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7974


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