|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-03-07 19:41:43
On Thursday, March 7, 2002, at 06:35 PM, rwgk wrote:
> 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?
Hopefully yes. You can do this with Metrowerks today, although by
default typeof is spelled __typeof__. And it might be better to do the
following to avoid requiring an accessible default constructor:
template <class T> T make();
template<typename TypeLHS, typename TypeRHS>
struct binary_operator_traits {
typedef typeof(make<TypeLHS>() + make<TypeRHS>()) arithmetic;
};
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk