![]() |
Glas :Re: [glas] Re: GLAS requirements |
From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-01-07 10:51:10
On Jan 7, 2005, at 6:14 AM, Karl Meerbergen wrote:
> template <class T>
> struct value_traits {
> typedef T value_type ;
> typedef T& reference ;
>
> /// Set t to one.
> void one( reference t ) ;
>
> /// Set t to zero.
> void zero( reference t ) ;
> };
I'd much prefer if "one" and "zero" would be named "unity" and
"identity" in the context of a ring.
Also, this concept might be better expressed as a trait "blob", because
the unity does not make sense without the identity, and the identity if
a type (say double) is ambiguous: you need to ask about the identity of
the type _with an operation_, e.g.,
get_identity<double>()
could return either 0.0 or 1.0, because both are identities for
different operations. In the context of a ring, however, 0.0 is the
identity and 1.0 is the unity and there is no confusion. This may be
best expressed by calling the above structure "ring_traits" instead of
"value_traits".
Doug