Boost logo

Boost :

From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2001-08-16 14:47:41


I am thinking about implementing a "small matrix" library for
2-dimensional arrays. (This would be similar to boost::array,
i.e. the small matrices will usually live on the stack to avoid
the dynamic memory allocation overhead.)

One requirement is to have operators for *heterogeneous*
arithmetic operations, e.g. multiplication. E.g. something
like:

template <class LR, class L, class R>
matrix<LR> operator*(const matrix<L>& lhs, const matrix<R>& rhs)
{
  // return the product
}

Is there a mechanism in C++ to define a table for the result type LR
depending on the types of L and R? For example, if L=int and R=int,
the result type LR=int, but for L=double and R=int the result type
should be LR=double, etc.

Thanks!
        Ralf

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/


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