Boost logo

Boost :

From: Dan W. (danw_at_[hidden])
Date: 2004-01-07 06:42:57


Daniel Frey wrote:
> Illegal AFAIK, you can't define $ portably. Just an idea:
> unit::make(value)[unit], e.g.:
> unit::speed s = unit::make( 42 )[m/s];
> and possibly the seriously overused _:
> #define _(x) unit::make(x)
> unit::speed s = _( 42 )[m/s];
> and at least _ without ( is not tainted. Maybe possible...

how about...

#define _( expr ) ::boost::spirit::compile_to_cpp( \" expr \" )

_( s = 2 m/s. );

..and then train spirit to tell 'm' the unit, from 'm the variable, or
whatever, from the context :) ?

dan


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