Erase-remove seems like poor naming, more than anything. I think that iterators 
(pretending things are arrays) are generally really handy. Alternatives 
(needing to do everything with pfns) really tend towards arcaneness and are 
often awkward to use.

In my experience, docs for 'our' containers are also miles behind what the STL 
has available.

We don't *always* need to use the maximally efficient container type. Let 
profiling and knowledge of use-cases show us when we need fast containers. Most 
of the time, I just want simple containers. (particularly for DEBUG-only code)

-Jeff

----- Original Message -----
From: "Robert O'Callahan" <rob...@ocallahan.org>
To: "Benoit Jacob" <jacob.benoi...@gmail.com>
Cc: "Chris Pearce" <cpea...@mozilla.com>, "dev-platform" 
<dev-platform@lists.mozilla.org>
Sent: Tuesday, December 10, 2013 2:04:06 PM
Subject: Re: Can we start using C++ STL containers in Mozilla code?

On Wed, Dec 11, 2013 at 10:50 AM, Benoit Jacob <jacob.benoi...@gmail.com>wrote:

> 2013/12/10 Robert O'Callahan <rob...@ocallahan.org>
>
>> Keep in mind that proliferation of different types for the same
>> functionality hurts developer productivity in various ways, especially
>> when
>> they have quite different APIs. That's the main reason I'm not excited
>> about widespread usage of a lot of new (to us) container types.
>>
>
> For the same reason as described above, I believe that adopting STL
> containers is the solution, not the problem! The STL shows how to design
> containers that have a sufficiently similar API that, in most cases where
> that makes sense (e.g. between a map and an unordered_map), you can switch
> containers without having to adapt to a different API.
>

I'm not a fan of the STL's approach of making every data structure feel
like an array. It leads to nonsense like the erase-remove idiom. A remove
function that doesn't actually remove anything, now that's a footgun :-).

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to