Disable some concept checks in C++11
François Dumont
frs.dumont@gmail.com
Wed Mar 8 21:03:00 GMT 2017
On 05/03/2017 22:58, Jonathan Wakely wrote:
> On 5 March 2017 at 16:03, François Dumont wrote:
>> It checks for both valid copy constructor and assignment operator. As far as
>> I know containers never use copy assignment operator and never did. So why
>> checking for its availability ?
> Of course they use it, as a quick search in the standard shows.
>
> Consider:
>
> std::vector<X> v(1), v2(1);
> v1 = v2;
>
> Before C++11 elements were also assigned when inserting or erasing in
> a vector (anywhere except the end), or when using std::sort, or using
> std::remove_if etc. etc.
> Now they will be move-assigned if possible, but some operations still
> require CopyAssignable.
>
Indeed, I had in mind more elementary operations that could justify
this concept check at class scope while in fact not complying to it only
impacts a limited number of operations on the container. I start getting
the point why current concept checks are not really used.
So slist also require it for its assign implementation. And a slist
of not assignable type instances is used in
libstdc++-prettyprinters/59161.cc. Should I just forget about it ? Go
ahead with the patch except the slist part and then disable concept checks ?
François
More information about the Libstdc++
mailing list