Boost logo

Boost :

From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2001-01-12 14:46:55


Jeremy Siek wrote:

> As for the one() and zero() functions, you'll see below I didn't use a
> traits function, but instead used a free function that takes an argument
> of the number type (the argument isn't really used, it just carries the
> type).

Why would you want to pass an object then?

  template <typename X> X one();
  template <> int one() { return 1; }

  int o = one<int>();

OK, there may be compilers which don't accept this standard code but
why should I create a temporary 20000x20000 matrix to get a unity matrix?


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