Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-01-14 14:37:09


On Fri, 12 Jan 2001, Matt Austern wrote:
auster> First, in some cases you're not interested in "one" and
auster> "zero", but in whether something is an identity element.
auster> You're using "zero" in AbelianGroupConcept, but that's not
auster> very reasonable. The set of nonzero real numbers under
auster> multiplication is a perfectly good abelian group, but the
auster> identity element is 1. Finding an identity element for a
auster> group requires a number type and an operation type.
auster> (Names like "one" and "zero" make more sense when you're
auster> talking about rings than when you're talking about
auster> groups.)

Sorry, the name of that concept was misleading. I should have used
AdditiveAbelianGroup instead of just puting a note in the comments.

auster> Second, as a technical issue: in one of the SGI
auster> extensions, we did something like this for the power()
auster> function. We used a free function called
auster> identity_element, which took as an argument the
auster> multiplication function. This turned out to cause endless
auster> pain when we were trying to use it with nested types,
auster> nested multiplication functions, and so on. When Hans was
auster> trying to use this for rope "exponentiation", he had to
auster> worry about some of the more obscure corners of overload
auster> resolution rules. He never did quite get it to work as he
auster> had originally planned.

Perhaps for some higher-level concepts, the operations can
be assumed to be the usual ones so the identity_element function
can just be parameterized on the domain type, which I think
would simplify the situation for nested types.

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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