lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Switch to using C++11 uniform initialization in the ctor initi


From: Greg Chicares
Subject: Re: [lmi] Switch to using C++11 uniform initialization in the ctor initializer lists?
Date: Mon, 27 Aug 2018 23:06:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 2018-08-24 13:08, Vadim Zeitlin wrote:
[...]
>  Honestly, I just hate this vector so much that I'd be glad to never use
> it again. Just try to guess what does this do if you see it for the first
> time:
> 
>     :allowed_(cardinality_of_the_enumeration, true)
> 
>  Using make_container_of_size() would be really much nicer in this, and
> plenty of other, cases IMO.

Not IMO though. Here's how I read it:

- "cardinality" as the first argument of a two-argument vector::vector
call strongly suggests it's the C++98 ctor.

- "allowed_" suggests boolean, so "true" looks like a default value.

BTW, the actual type is
    std::deque<bool> allowed_;
because at some time that was how I coded the not-a-container vector<bool>.
But recently I used std::vector<int> for that purpose. Which is better IYO?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]