From: Mark D Rintoul (rintoul_at_[hidden])
Date: 2001-01-12 13:22:37
Jeremy Siek wrote:
> As for the one() and zero() functions, you'll see below I didn't use a
> traits function, but instead used a free function that takes an argument
> of the number type (the argument isn't really used, it just carries the
> type). This interface has the benefit that it could even work for things
> like matrices where one might need to create an identity element with the
> correct number of rows and columns.
It should be noted that the SGI STL has something like that
already. It defines an overloaded function "identity_element" for
the "plus" and "multiplies" structs. It might be worthwhile having
inheritable classes such as "ring" or "group" or "monoid" or something
and define identities and inverses and such.
-- ------------------ Mark D. (Danny) Rintoul, Dept. 9235 Computational Biology & Materials Technology Sandia National Laboratories Phone: (505) 844-9592, Fax: (505) 845-7442 email: rintoul_at_[hidden] ------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk