On Tue, Dec 10, 2013 at 09:17:22AM -0600, Joshua Cranmer ? wrote:
> On 12/10/2013 3:28 AM, Chris Pearce wrote:
> >Hi All,
> >
> >Can we start using C++ STL containers like std::set, std::map,
> >std::queue in Mozilla code please? Many of the STL containers are
> >more convenient to use than our equivalents, and more familiar to
> >new contributors.
> >
> >I understand that we used to have a policy of not using STL in
> >mozilla code since some older compilers we wanted to support
> >didn't have very good support, but I'd assume that that argument
> >no longer holds since already build and ship a bunch of third
> >party code that uses std containers (angle, webrtc, chromium IPC,
> >crashreporter), and the sky hasn't fallen.
> 
> The sizeOfExcludingThis/sizeOfIncludingThis methods on our
> containers are one feature not found in STL. There are some codesize
> concerns in using STL, as it is much more template-heavy than our
> own implementations (particularly in regards to
> std::unordered_map/nsTHashtable). The final issue is that
> performance characteristics may be very different: C++11 disallows
> copy-on-write semantics for std::string, for example; in another
> edge case, most STL containers' move constructors require noexcept
> semantics to become enabled (and autodegrades move to copy in most
> cases), and I'm not certain that compiling without exception support
> would grant us those semantics.
> 
> Also, std::set and std::map are the wrong containers to use 95% of
> the time. If people don't want to use nsTHashtable because the API
> sucks, it's better to change the API for nsTHashtable rather than
> use the wrong datatype.
> 
> I think the right answer is to make the myriad of datatypes we have
> more STL-ish--as a first step at least, can we at least add iterator
> support for them and get rid of the abominable
> EnumerateForwards/EnumerateBackewards methods? This would allow us
> to use range-based for once our minimum compiler support gets there.

+1

Mike
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to