Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-09-14 18:38:08


"Terje Slettebø" <tslettebo_at_[hidden]> wrote

#include <boost/operator_traits/has_plus_op.hpp>
#include <boost/operator_traits/has_minus_op.hpp>
#include <boost/concept_traits/std/is_assignable.hpp>

template<class T1,class T2>
struct is_my_concept :
  mpl::and_<
    is_assignable<T1>,
    is_assignable<T2>,
    has_plus_op<T1, T2>,
    has_minus_op<T1, T2>
> {};

Why not :

has_op< T1,plus, T2> ?

hence:

#include <boost/operator_traits/has_ops.hpp>

template<class T1, class Opa, class Opb,class T2>
struct is_my_concept :
  mpl::and_<
    is_assignable<T1>,
    is_assignable<T2>,
    has_op<T1, Opa,T2>,
    has_op<T1, Opb, T2>
> {};

eg
+ -
 * /

believe me this saves a lot of coding.

regards
Andy Little


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