[v3] Add missing forward_list<>::splice_after and merge overloads fix splice_after taking a range

François Dumont frs.dumont@gmail.com
Fri Apr 13 07:18:00 GMT 2012


Yes this patch is just fine too. I knew the usage of a static bool 
constant won't be appreciated and indeed I find your version cleaner. 
And yes, other kind of empty ranges are fine.

Do you apply it ? If so you should perhaps add my modification of the 
splice_after.cc test case unless you have plan to add this kind of use 
case in some code to come.

François


On 04/13/2012 03:29 AM, Paolo Carlini wrote:
> Hi,
>
> and thanks for the quick feedback.
>
> On 04/12/2012 11:20 PM, François Dumont wrote:
>> One thing after the other :-)
>>
>> Here is a patch to fix this issue Paolo. The safe iterator 
>> _M_valid_range method was considering that a range with different 
>> iterators and last being a begin one is invalid which is wrong when 
>> there is a before_begin.
>>
>> 2012-04-12  François Dumont <fdumont@gcc.gnu.org>
>>
>>     * include/debug/safe_iterator.h (_BeforeBeginHelper<>::__value): 
>> Add.
>>     (_Safe_Iterator<>::_M_is_beginnest()): Add.
>>     * include/debug/safe_iterator.tcc
>>     (_Safe_Iterator<>::_M_valid_range): Use latter.
>>     * include/debug/forward_list (_BeforeBeginHelper<>::__value): Add.
>>     * testsuite/23_containers/forward_list/debug/splice_after.cc:
>>     Add check.
>>
>> Tested in 4.7 branch linux x86_64.
>>
>> I did this patch in the 4.7 branch because I only had this one ready 
>> and moreover I think it should be integrated in it.
> Definitely should.
>
> First, I didn't realize so far that we really have a special case 
> here, that is only the pair before_begin, begin currently gives 
> problems (I suppose you double checked already that other sorts of 
> empty ranges are fine).
>
> Then, in terms of implementation details, something like what I'm 
> attaching looks a bit more clear to me. What do you think?
>
> Paolo.
>
> ///////////////////////



More information about the Libstdc++ mailing list