|
Ublas : |
From: Michael Stevens (mail_at_[hidden])
Date: 2005-09-14 04:23:24
On Mittwoch 14 September 2005 09:06, Ott Toomet wrote:
> Dear Vardan and Michael,
>
> unfortunately shallow_array_adaptor does not work for me. If I
> declare
>
> #define BOOST_UBLAS_SHALLOW_ARRAY_ADAPTOR
>
> it results compiler errors:
>
> g++ -c aakatse.c++ -O2 -Wall -Wno-unknown-pragmas -I/usr/include
> In file included from /usr/include/boost/numeric/ublas/vector.hpp:23,
> from aakatse.c++:4:
> /usr/include/boost/numeric/ublas/storage.hpp:707: error: declaration of
> `class T' /usr/include/boost/numeric/ublas/storage.hpp:703: error: shadows
> template parm `class T'
>
> even without any additonal code.
>
> Is it a problem with boost 1.32/gcc 3.4 or do I have to do someting in
> a different way?
It something that only recent(ish) 'gcc' complain about. This was the fix I
just applied to 1.33. The change is fairly simple. The delaration round line
707 need to change to
template<class TT>
struct leaker {
typedef void result_type;
typedef TT *argument_type;
BOOST_UBLAS_INLINE
result_type operator () (argument_type x) {}
};
That is, the template parameter is renamed TT from T.
You can use array_adaptor but you need to bind it to an array after the
container has been constructed thus:
double a[] = {-11, -12, -13, -14};
vector<double, array_adaptor<double> > v(4);
v.data ().resize (4, a);
Michael
-- ___________________________________ Michael Stevens Systems Engineering 34128 Kassel, Germany Phone/Fax: +49 561 5218038 Navigation Systems, Estimation and Bayesian Filtering http://bayesclasses.sf.net ___________________________________