[Bug libstdc++/15523] Can't have vectors of vector::const_iterator

bangerth at ices dot utexas dot edu gcc-bugzilla@gcc.gnu.org
Thu May 20 18:43:00 GMT 2004


------- Additional Comments From bangerth at ices dot utexas dot edu  2004-05-19 17:39 -------
Subject: Re:  Can't have vectors of vector::const_iterator


> I think in most cases it would be sufficient to create an empty
>     vector, set it its vector<>::capacity(), and then push_back() new
>     values into it.

That's exactly what I ended up doing in our code.


> My naive expectation would be that -D_GLIBCXX_DEBUG_PEDANTIC would
>     cause an abort() for all dectectable undefined behavior. I think
>     most other users would expect this as well, *but* many probably
>     don't realize this extends to aborting on the copy of a singular
>     iterator, much less to aborting on the creation of the vector full
>     of singular iterators. OTOH, some users expect implementations to
>     report errors they don't know about.

As I said, I don't feel strongly way, I'm just confused because I don't see a 
reaonsing behind this particular check. What harm does it do to copy an 
object that you will not be allowed to use anyway? Since the standard says 
that behavior is undefined, we have some leeway in implementing sensible 
behavior, in particular since we know that this can never hurt anyone.

But I'm fine if we decide that this is NAD and that we should close this PR. 
Please feel free to do so if you want.

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15523



More information about the Gcc-bugs mailing list