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

valyala at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jan 23 10:45:00 GMT 2012


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: unassigned@gcc.gnu.org
        ReportedBy: valyala@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=169421&view=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_iterator<T *, 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.



More information about the Gcc-bugs mailing list