[SAoC] Move semantics and STL containers
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Thu Dec 19 22:58:06 UTC 2019
On Thursday, 19 December 2019 at 20:09:36 UTC, Gregor Mückl wrote:
> On Thursday, 19 December 2019 at 13:49:36 UTC, Ola Fosheim
> Grøstad wrote:
>> std::pair is just a std::tuple, so does this mean std::tuple
>> is usable?
>
> Careful: while std::pair is semantically a 2-tuple, it is
> actually a completely separate type and not a specialization.
>
> My guess is that this can't be corrected now because std::pair
> is older than std::tuple and was used in std::map and related
> associative containers.
Yes, it predates C++11 and the members are called first and
second, but supports all the same operations except assignment?
So the D implementation should be similar, I think?
(I consider pair to be legacy so I don't use it anymore.)
More information about the Digitalmars-d
mailing list