On 3/15/2015 2:33 PM, Seth Fowler wrote:
> I don’t really care what we do - keep in mind, I had nothing to do > with introducing mozilla::Pair - but I think that we should
recommend > the use of one thing, either std::pair or mozilla::Pair. If
we choose > to prefer std::pair, we should probably remove mozilla::Pair.
The reason why we have mozilla::Pair is that we needed a pair type that
was sizeof(T1) if T2 was empty (for mozilla::UniquePtr). I suggested
that such a utility might be more widely valuable and thus that it
should be split out as a separate mozilla:: type rather than a
mozillla::detail:: type. std::pair is required to have the two elements
be listed as members by the specification, although I think std::tuple
may similarly have the empty-types-take-no-space optimization
(mozilla::Pair was added before MSVC 2013 requirement and thus before
variadic templates).
In general, std::pair should be preferred over mozilla::Pair unless you
need the empty type optimization.
--
Joshua Cranmer
Thunderbird and DXR developer
Source code archæologist