This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [v3] Add missing forward_list<>::splice_after and merge overloads fix splice_after taking a range


Hi,
Hi,

Nico noticed in private email that we weren't implementing LWG 1310, thus I proceede to add the required overloads, pretty trivial work (suited for 4.7.1 too).

But then, when I got to the testcases I noticed that really almost nothing worked as expected for the splice_after overload taking a range: memory leaks easily noticeable for existing testcases too; also showing up as "disappearing" elements of the destination forward_list; in some cases the end of the range improperly handled (thus, as , last], instead of last), as must always be). Hey, we had a complexity much lower than the expected O(distance(first, last)) per C++11 ;) Thus I'm fixing this rather serious issue too. Have a look, tomorrow I mean to commit to mainline.

Tested x86_64-linux, normal and debug (and a lot of valgrind too).
I'm going with something a bit more invasive, cleaning up a bit the _M_* helpers.

Francois, can you please review the debug-mode checks for cases like:

std::forward_list<int> fl1(1), fl2(1);
fl1.splice_after(fl1.before_begin(), fl2, fl2.before_begin(), fl2.begin());


?

I don't think we should error out. We don't for things like:

    std::list<int> fl1(1), fl2(1);
    fl1.splice(fl1.begin(), fl2, fl2.begin(), fl2.begin());

ie, the source is in both cases just an empty range, not an invalid range.

Thanks,
Paolo.

/////////////////////

Attachment: CL_nico_3
Description: Text document

Attachment: patch_nico_3
Description: Text document


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