From: Jeremy Graham Siek (jsiek_at_[hidden])
Date: 2004-07-09 11:28:30
Yes, you've got the idea.
The following document shows one such attempt to construct a
system of traits for algebraic concepts:
also, more information is available starting at:
On Jul 7, 2004, at 7:32 PM, Paul C. Leopardi wrote:
> Jeremy, Dave,
> I think I get it. See below.
> Best regards
> On Thursday 08 July 2004 02:25, David Abrahams wrote:
> > Jeremy Graham Siek <jsiek_at_[hidden]> writes:
> > > group_traits<T>::is_commutative
> > is_commutative_group<T>::type
> > is_commutative_group<T>::type::value
> OK, for a type where you have one operation (a group).
> For a two operation type, I suppose you would then want
> Along these lines, you could build a header file called
> or something similar. The object of this file would be to describe
> some of
> the semantics of operator+, operator* and possibly other operators
> when used
> with various types. Eg. you could have say
> is_algebra< framed_multi<T,L,H>, T>::type
> is_algebra< framed_multi<T,L,H>, T>::scalar_type
> This header would also be used to define the zero element of addition
> and the
> identity element of multiplication, if it exists.
> Once this header is established, you could build template libraries
> perform arithmetic according to the axioms embodied in the traits.
> Such a
> library would not eg. assume that multiplication is commutative, it
> check this at compile time.
> Note that there would also need to be a distinction between
> approximate and
> exact arithmetic. This especially affects associativity, where eg.
> of real numbers behaves differently from addition of floating point
> due to loss of precision. eg.
> Yahoo! Groups Sponsor
> Yahoo! Groups Links
> To visit your group on the web, go to:
> To unsubscribe from this group, send an email to:
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Jeremy Siek <jsiek_at_[hidden]>
Ph.D. Candidate, Indiana University Bloomington
C++ Booster (http://www.boost.org)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk