Boost logo

Boost :

Subject: Re: [boost] [Better Enums] More complete release - feedback requested
From: Sam Kellett (samkellett_at_[hidden])
Date: 2015-06-11 04:12:03


On 10 June 2015 at 18:39, Anton Bachin <antonbachin_at_[hidden]> wrote:

> Hi,
>
> Thanks for the comments.
>
> > A. get rid of the leading _ un function names.
>
>
+1

> [snip]
>

>
Channel::_from_string(“Red”);
> vs.
> better_enums::traits<Channel>::from_string(“Red”);
>
> I could get some degree of type inference to happen by wrapping the traits
> functions in freestanding template functions, but it was still too verbose
> (IMO), and also threw away the advantage of a uniform and easy-to-remember
> interface.
>

I would prefer free-functions in a namespace. Something like:

better_enums::from_string<Channel>("Red");

(although I think the namespace is too long. Maybe just 'enums'?)

> [snip]
>
> > B. make size a constexpr function
>
>
+1

> What would be the advantage to this? Uniformity of interface? Is there any
> disadvantage from this change? I generally want to move in the direction of
> making more things available to C++03 metaprogramming, so I am worried
> about
> making constants into functions.
>
>
I think you should look to the future and give pay-off to people using more
modern C++. However you can macro-ize the constexpr keyword so that it is
constexpr is supported or nothing if not.

BOOST_NO_CXX11_CONSTEXPR will do the check for you.


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