Boost logo

Boost :

Subject: Re: [boost] [constrained_value] Constrained Value review results
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2010-10-05 21:43:31

Hello All,

As Gordon Woodhull has suggested, it'd be nice to try finding a better name for bounded_int:

> The unique characteristic of this class is not that it's bounded or an int, but that the bounds are
> specified at compile time.

And from private correspondence:

> As Thorsten mentioned, it might be helpful to brainstorm/vote on the list for a better name for
> bounded_int. My favorite at this point is static_bounded, since the use of a class static variable
> for bounds is probably rare. But you could probably do better.

The template in a simplified form looks like this:

template<typename ValueType, ValueType LowerBound, ValueType UpperBound>
struct bounded_int
{ ... }

Its characteristics are that the underlying value type is the same as the bounds type and the bounds are specified as compile time
constants. According to the C++ Standard, type of the constants may be:
- integral/enumeration,
- pointer/reference to object/function,
- pointer to member.
Of the types, the most likely use case is integral, whence the name bounded_int (as a shortcut for "bounded integral", not
necessarily "bounded integer"). This name does not express all the possible use cases, but it's hard to find a terse form of
bounded_by_compile_time_constants. Somehow I don't like static_bounded because it may suggest that the underlying value or the
bounds are static objects (in the meaning "global"); fixed_bounded or compile_time_bounded sounds no better to me.

So, as I'm having difficulty with finding a good name, any ideas and opinions are appreciated. :)

Best regards,

Boost list run by bdawes at, gregod at, cpdaniel at, john at