Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-10-04 15:19:23


Bronek Kozicki wrote:
> Edward Diener <eddielee_at_[hidden]> wrote:
>> In reality I use property extensions in certain C++ implementations
>> to do this. Of course the property concept, which translates into
>> setter and
>> getter calls in standard C++, is useful for other things also such as
>> triggering other actions when a value is set.
>
>
> I think that it's possible to implement such getter/setter calls in
> standard C++ . Maybe this could be more generic way to achieve some
> part
> of goal you specified ?

The getter, setter property technique is much more general than what I
suggested with my query about implementing ranges and/or specific values for
types, and is really another subject of its own which might be "Can
properties be implemented using standard C++ ?" I think the answer is yes,
but with some small overhead.

OTOH my original query would probably be done via an assignment operator
which would check whether or not the value being assigned would be of a
given range or value. The question is, how can one specify ranges and/or
values generically when creating the type or the variable ?

At the type level, one might perhaps be able to specify the ranges and/or
values with some sort of typelist of non-type template parameters. At the
variable level, one might be able to do it in the constructors. I would
prefer to do it at the type level, so that each variable has its own unique
type for the range and/or values specified. This would more closely mimic
those languages which actually create new types via their ranged variables.


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