Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-26 05:35:13

From: "Ross Smith" <r-smith_at_[hidden]>
> As long as we're all piling on, here's yet another suggestion...

[ based on operator Result() ]

> Now we can use boost::pi() as a constant, and the type will be deduced
> from the context. If the context gives the wrong type or is ambiguous,
> just use an explicit cast. (This doesn't quite solve the "people who
> want to use 'pi' unadorned" problem, but I think a simple pair of
> parentheses should be acceptable.)

All these solutions have a common drawback:

template<class Numeric> void foo(Numeric n);

foo(pi()); // calls void foo<some_type_that_is_not_numeric>

Peter Dimov
Multi Media Ltd.

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