Boost logo

Ublas :

From: Peter Schmitteckert (peter_at_[hidden])
Date: 2005-08-17 09:36:18


Dear Karls,

On Wed, 17 Aug 2005, Karl Meerbergen wrote:

> Hi Peter,
>
> Look at static consts in scalar_assign in functional.hpp
> A similar implementation may help solve the problem.

I've added a specialization into my code,

const identity_matrix<double>::value_type identity_matrix<double>::zero_ (0);
const identity_matrix<double>::value_type identity_matrix<double>::one_ (1);

so at least my code runs.
But I'm a little buit confused now.

gcc is complaining a missing instantiation, which I've explicitly
provided aobove.

In matrix.hpp we have

template<class T>
const typename identity_matrix<T>::value_type identity_matrix<T>::zero_ (0);
template<class T>
const typename identity_matrix<T>::value_type identity_matrix<T>::one_ (1);

Now, what does this actually means.
Should there be an object, i.e. something where I can have an adress of,
or is it just a something the compiler should 'inline' (but it is not a
function).

Can one have a static const without an object with an adress?
If an object is created, then the code should not be in
a header file, otherwise one could end up with multiple instantiations.
Which would be harmless here, so this is more or less an 'academic
question'.

Best wishes,
Peter

_______________________________________

Dr. Peter Schmitteckert
TKM / CFN University of Karlsruhe
++49 721 608 3363