Boost logo

Boost :

Subject: Re: [boost] [gsoc16] Can I quickly check if the below really is the best approach?
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2016-01-14 19:46:51


Niall Douglas <s_sourceforge <at> nedprod.com> writes:

>
> Dear Boost,
>
> 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?

I don't see an __easy__ way to do better, i.e. without writing your own map.

> BTW by static constant associative map of keys to values I mean the
> thing me and Tony van Eerd were speaking about here last year and the
> year before, and indeed frequently at BlackBerry!
>
> Niall
>
> [1]: I believe Boost.Hana could implement a static constan
> associative map quite easily, but I'd be fairly sure Hana will likely
> be beyond most students.

Only if the keys are known at compile-time. Otherwise, it's out of Hanaland.

Anyway, here's an attempt to implement such a map:
    
    https://gist.github.com/ldionne/f7ff609f00dc7025a213

I don't know if it's worthwhile, but it's there. Don't hesitate to let me
know what you think.

Regards,
Louis


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