Boost logo

Boost :

Subject: Re: [boost] [constrained_value] Constrained Value review results
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2010-10-06 20:45:10


> From: Stewart, Robert
> My preference
> is to use "CT" for that (because its an abbreviation for "compile time"), though it is very terse and
> could mean other things in other contexts.

"ct" is indeed cryptic, but I think it won't be easily mistaken for something else (like "int" in "bounded_int" might be) and once
one gets to know it stands for "compile time" the names become quite clear:

bounded<int> // bounds specified at runtime
bounded_ct<int, 0, 10> // bounds specified as compile time constants

Looks good to me.

Maybe even "c" alone would suffice?

bounded_c<int, 0, 10>

Reminds me of boost::mpl::integral_c.

> instead of "bounded," use "bound," "bounds,"

Using "bound" or "bounds" seems misleading to me. The object represented by the type is a bounded value, not value of the bounds.

> or "constrained."

Constrained objects are a superset of bounded objects while we're looking for a name for a subset of bounded objects so using
"constrained" does not make sense.

> >From among these, my vote would be for "ct_bound_int" or "constant_bounds_int" and being short and
> clear.

The "int" suffix is unnecessary, the whole point was to replace it with something better. ;-)

> From: Christian Holmquist
> I think bounded_int or bounded_integral seems just fine.

bounded_integral is more precise than bounded_int, but still not exhaustive (integrals are not all possible types that can be used).

> From: Thorsten Ottosen
> bounded_int and bounded_float is fine with me too. Since the library is
> called constrained_value, contrained_int and constrained_float would be
> fine too.

Ditto about "constrained". And why "bounded_float"? I was thinking that for floats you would just use "bounded" template.

> From: Paul A. Bristow
> I also like the word 'static' - it implies 'fixed at compile time' to me,
> but I agree static has other possible implications.

How about "statically_bounded"?

> So
>
> fixed_bound is my suggestion, FWIW.
>
> fixed_bound<int, 0, 23>::type hour;

Ditto about "bound". And "fixed_bounded" looks weird, it's as if the value was itself fixed. But maybe it's not that bad?

Thanks for the replies and best regards,
Robert


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