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: [Patch, libstdc++/64584, libstdc++/64585] Clear basic_regex after imbue and make assign exception tolerant


On 11 April 2015 at 22:15, Tim Shen wrote:
> On Sat, Apr 11, 2015 at 9:10 PM, Daniel KrÃgler wrote:
>> 24.2.2 [iterator.iterators] requires them to be CopyConstructible and
>> CopyAssignable, these imply the two more reduced requirements.
>
> Ah I see, sorry for bothering.

You don't need to look in the standard, iterators must be move
constructible, or the whole of <algorithm> needs fixing.

Consider:

struct Container
{
  struct iterator { /*...*/ };
  iterator begin();
  iterator end();
};

Container::begin() and Container::end() return rvalues, and most
algorithms take their arguments by value, so if Container::iterator is
not move constructible this won't compile:

Container c;
std::sort(c.begin(), c.end());

Obviously this code is expected to work, so iterators must be move
constructible.


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