This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: std::pair copy and move constructor
- From: Daniel Krügler <daniel dot kruegler at gmail dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 15 Feb 2013 22:00:05 +0100
- Subject: Re: std::pair copy and move constructor
- References: <511EA09D.8000704@gmail.com>
2013/2/15 François Dumont <frs.dumont@gmail.com>:
> Hi
>
> I had a problem with the result of
> std::is_copy_assignable<std::pair<const int, int>>::type which used to be
> true_type. So here is a patch to fix that.
This patch would break with the requirements of the library. In
particular it would prevent that std::pair's of references are
copy-assignable and that exactly is the purpose for the user-provided
copy-assignment operators of pair (and tuple).
- Daniel
> 2013-02-15 François Dumont <fdumont@gcc.gnu.org>
>
> * include/bits/stl_pair.h (pair): Use default implementation for
> copy and move constructors.
> * testsuite/20_util/pair/is_copy_assignable.cc: New.
> * testsuite/20_util/pair/is_move_assignable.cc: New.
>
> I kept some checks commented. For is_copy_assignable.cc is looks like
> DeletedMoveAssignClass has also its copy assignment operator deleted. In
> is_move_assignable.cc even when pair is only composed of
> DeletedMoveAssignClass it looks like the pair still have a move assignment
> operator.
>
> I was surprised to see that those operator were not already using the
> default implementation so sorry if I miss the mails explaining why.
>
> Tested under Linux x86_64.
>
> François
>