Boost logo

Boost :

From: rwgk (rwgk_at_[hidden])
Date: 2002-03-07 18:35:20

With the language features that are currently available
I find myself using (idea stolen from Blitz++):

  // The default traits: the result type is the type of the lhs
  template<typename TypeLHS, typename TypeRHS>
  struct binary_operator_traits {
    typedef TypeLHS arithmetic;

  // The remainder of this file defines the traits where the
  // result type is the type of the rhs argument.

  struct binary_operator_traits<signed char, short > {
    typedef short arithmetic;

  // ... etc. etc.

In the future, assuming that typeof is accepted into the standard,
will I be able to do this ...

  template<typename TypeLHS, typename TypeRHS>
  struct binary_operator_traits {
    typedef typeof(TypeLHS() + TypeRHS()) arithmetic;

... and avoid all the specializations?


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