Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-01-14 21:45:58

Jeremy Siek wrote:
> However, I'd like to see something much simpler
> than what is in the Algebra library... something along the lines of
> is_associative<Domain, Op>::type (true_type or false_type)
> ::value (true or false)
> Then use this in a static assert in the appropriate concept checking
> classes.
> It would be nice if we could have a fairly portable system, works
> with VC++, Borland, etc. That means no partial spec. :(

How about the following form:


There are several ways to make the following code compile under MSVC:

template<typename Domain>
struct algebraic_traits {
  template<typename Op> struct is_associative {
    BOOST_COMPILE_TIME_CONSTANT(bool, value = false);

// some non-portable tricks ...

struct plus_operator;
struct my_domain;

...and others compilers should be happy with a plain (full) explicit

template<> template<>
struct algebraic_traits<my_domain>::is_associative<plus_operator> {
 BOOST_COMPILE_TIME_CONSTANT(bool, value = true);


Boost list run by bdawes at, gregod at, cpdaniel at, john at