> On Mar 13, 2015, at 6:14 AM, Eric Rescorla <e...@rtfm.com> wrote: > > Sorry if this is a dumb question, but it seems like std::pair is fairly > widely used in our > code base. Can you explain the circumstances in which you think we should be > using mozilla::Pair instead?
It’s not at all a dumb question. This came up on IRC every time mozilla::Pair came up, so a lot of people are wondering about this. I’m not the person that originally introduced mozilla::Pair, so I wouldn’t consider my answer to this question definitive, but I’ll give it a shot anyway. mozilla::Pair is about avoiding implementation quality issues with std::pair. There are two quality issues in particular that have bit us in the past: - Poor packing, particularly when one of the types stored in the pair has no members. In that situation the empty type should consume no space, but std::pair implementations sometimes don’t handle that case efficiently. - Poor or non-existent support for move semantics. I don’t know specifically about the case of std::pair, but this is still biting people with other STL containers quite recently. Obviously the same code can have significantly different performance characteristics in some cases depending on move semantics support, so this is a serious problem. Until we know that we can rely on high quality std::pair implementations everywhere, my recommendation would be to always use mozilla::Pair. - Seth _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform