Boost logo

Boost :

From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 2002-03-08 10:20:47


Howard Hinnant <hinnant_at_[hidden]> writes:

| 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;

However, this would require a definition for make()...

-- Gaby


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