[Bug libstdc++/51981] Missing uninitialized_move() implementation?

2012-01-25 Thread valyala at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51981

--- Comment #3 from Aliaksandr Valialkin valyala at gmail dot com 2012-01-25 
14:38:50 UTC ---
(In reply to comment #2)
 It looks like it would be equivalent to uninitialized_copy with
 make_move_iterator, not so useful then.

This makes sense, but not so obvious for novices in C++11.

If continuing in this vein, then std::move() can be substituted by std::copy()
with input iterator wrapped into make_move_iterator(). Then std::move() is not
so useful :)


[Bug libstdc++/51981] New: Missing uninitialized_move() implementation?

2012-01-24 Thread valyala at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51981

 Bug #: 51981
   Summary: Missing uninitialized_move() implementation?
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: valy...@gmail.com


It's interesting to know why uninitialized_copy()'s counterpart -
uninitialized_move() - is missing in
http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_uninitialized.h?revision=177542view=markup
?

See boost's docs for details -
http://www.boost.org/doc/libs/1_48_0/doc/html/boost/uninitialized_move.html .


[Bug libstdc++/51960] New: Missing move-assignment operator in raw_storage_iterator

2012-01-23 Thread valyala at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51960

 Bug #: 51960
   Summary: Missing move-assignment operator in
raw_storage_iterator
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: valy...@gmail.com


It's interesting why raw_storage_iterator (
http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_raw_storage_iter.h?revision=169421view=markup
) doesn't provide move-assignment operator? Such an operator would allow moving
items to a raw memory instead of copying them. In this case the
raw_storage_iterator could be properly used with std::move()-like algorithms:

template typename InputIterator, typename T
void move_to_raw_buffer(InputIterator first, InputIterator last, T *raw_buffer)
{
  std::move(first, last, std::raw_storage_iteratorT *, T(raw_buffer));
}

Currently this results in items' copying instead of expected items' movement
due to the lack of move-assignment operator in the raw_storage_iterator
implementation.


[Bug libstdc++/51965] New: Redundant move constructions in heap algorithms

2012-01-23 Thread valyala at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51965

 Bug #: 51965
   Summary: Redundant move constructions in heap algorithms
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: valy...@gmail.com


Created attachment 26426
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26426
Eliminate unnecessary move constructions in stl_heap.h

Currently Heap implementation (
http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_heap.h?revision=181987view=markup
) contains redundant move constructions. These constructors are invoked when
passing rvalue __value to std::__push_heap() and std::__adjust_heap(). It would
be better passing the __value into these functions by reference instead. This
eliminates redundant move constructions and results in 3x reduction of the
number of move constructor calls inside heap functions such as make_heap() and
sort_heap().

See the attached patch for details.


[Bug libstdc++/51965] Redundant move constructions in heap algorithms

2012-01-23 Thread valyala at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51965

--- Comment #1 from Aliaksandr Valialkin valyala at gmail dot com 2012-01-23 
13:51:16 UTC ---
Created attachment 26427
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26427
Testcase for determining redundant move constructions in stl_heap