Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2005-01-25 05:02:47


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 24 January 2005 20:33, Daryle Walker wrote:
> I don't know much about uBLAS, so sorry if I sound like an uneducated
> newbie. This sounds like you use "value_type(0)" whenever you need a zero
> value for a type. What's wrong with "value_type()"? Every built-in and
> user-defined numeric (scalar) type I know of makes the explicit default
> constructor evaluate its object to zero. This policy would be easier to
> accept for types that didn't want an "int" constructor. You have to use
> the explicit syntax because implicit default construction for built-in
> types leaves them as a bucket of random bits (for C compatibility and to
> not add extra code).

We already discussed this issue at the developer meeting. We finally decided
to use value_type(0) because value_type could be a big algebraic object, e.g.
a matrix. For matrices there is a big difference between allocating an empty
matrix using the default constructor and allocating a matrix full of zeroes
using the "int" constructor. Maybe this behaviour will be replaced by some
traits classes in a future version of ublas. The traits classes can provide
other useful information like value_type(1), too.

mfg
Gunter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB9hlOghsXb/J0PcERApPSAJ9D+zfP6EHZN641ug0YJEV/F2mlcQCgwqh6
8j3CerPMMheq1RIx0vQKdRo=
=ywxK
-----END PGP SIGNATURE-----