Boost logo

Ublas :

Subject: Re: [ublas] Numeric traits for ublas bounded_vector and matrix
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-02-23 15:55:00


Jesse Perla <jesseperla <at> gmail.com> writes:
> > proposing a static_matrix and static_vector to ublas would be the way (if
> > you want to stick to boost/ublas for your container needs)?

Wait a sec..... have I been a complete idiot for a full year? Should I be using
c_vector and c_matrix instead of the bounded_vector bounded_matrix?

So if you replace everything in this thread with c_vector instead of
bounded_vector, then I think that the result_of::size<> metafunction and the
has_static_size will work for vectors as written.

For the c_matrix: You can get at the first stride as an int_ since it has C
style ordering, but you can't get at the second strides. And the size_type<1>
trait in here is a ptrdiff_t.
I think we need something like has_static_size<> that works for the matrix
extents, and another to get at the static number of columns, etc.
Perhaps something like: size<T, 1> and has_static_size<T, 1> would work where
the integer parameter gives the dimension to choose over (independent of
the storage ordering since this would be more for higher level code.

As for the comment on how to make things more MPL friendly, I don't know that
much, but whenever I have used metafunction forwarding through inheritance
instead of implementing a ::type myself, things have always worked perfectly.