Boost logo

Boost :

Subject: Re: [boost] [gsoc16] Can I quickly check if the below really is the best approach?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-01-12 15:55:33


AMDG

On 01/12/2016 01:09 PM, Niall Douglas wrote:
>
> In the prototype https://svn.boost.org/trac/boost/wiki/SoC2016 at
> https://goo.gl/1CQAuQ I claim "Even with all of Boost's facilities
> [1] and using C++ 14, this program represents the currently best
> available method of implementing a static constant associative map of
> keys to values" and you can find either the code at the link or
> pasted below.
>
> Can I quickly check here if that claim is true? Is there a better way
> than my example program?
>
> <snip>
> int main(void)
> {
> {
> // Calls malloc() at least 7 times

If malloc is your biggest concern, try boost::container::flat_map.

> static const std::map<string_view, weekday> to_weekday1 =
> string_to_weekday;
> <snip>

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk