Extending Temporary buffer for rvalues

Christopher Jefferson chris@bubblescope.net
Sun Aug 30 08:20:00 GMT 2009


On 28 Aug 2009, at 10:31, Paolo Carlini wrote:

> Hi Chris,
>> Another attempt at a patch!
> Good, I like this version much better. But, I think you should rewrite
> the loop somewhat differently if you want it to actually work with
> *forward* iterators, you can't use, eg, __cur - 1 (by the way, as a
> minor detail, normally ++__cur is to be preferred to __cur++)

How's this?

Added a couple of tests. Note that this patch isn't enough to let  
stable_sort sort rvalue references, so that isn't tested. These tests  
just ensure the code works properly if a construction throws (at least  
no memory is leaked).

2009-08-29  Chris Jefferson <chris@bubblescope.net>
	* includes/bits/move.h : Add _GLIBCXX_FORWARD to wrap std::forward.
	* include/bits/stl_uninitialized.h : Add
	__uninitialized_construct_range.
	* include/bits/stl_tempbuf.h (_Temporary_buffer) : Make work with
	move-only types.
	* include/bits/stl_construct.h (_Construct) : Add perfect forwarding.
	* testsuite/25_algorithms/stable_partition/mem_check.cc : New.
	* testsuite/25_algorithms/stable_sort/mem_check.cc : New.
	* testsuite/util/testsuite_hooks.h : Add operator< to copy_tracker.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp_buf_patch_4
Type: application/octet-stream
Size: 9837 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20090830/874d5b54/attachment.obj>
-------------- next part --------------


Chris


More information about the Libstdc++ mailing list