Boost logo

Ublas :

Subject: Re: [ublas] [bindings] Initial support for glas and mtl containers
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-01-18 03:22:33


Karl Meerbergen wrote:

> Great. If I a have a white spot in the week-end I may have a look. Thanks
>
> Karl
>

FWIW, the other way around may also be easy,

template <typename T,
  enable_if<
    mpl::and_<
       bindings::has_linear_array<T>,
       bindings::has_rank<T,1> >
> >
struct DenseVectorCollection: mpl::true_ {};

I guess this would be a nice regression/test of the meta-functions available
in the bindings. After this, forward some free functions to the free
functions in the bindings, e.g.,

#include <boost/numeric/bindings/size.hpp>

template <typename E>
  struct size_functor<E, typename boost::enable_if<
StridedDenseVectorCollection<E> >::type > {
    typedef typename bindings::result_of::size<E>::type result_type ;

    result_type operator() ( E& e ) const {
      return ::boost::numeric::bindings::size( e ) ;
    }
  } ;

If you would like to know the type of pointer, that's just the
result_of::begin_value<T>::type.

As a sidenote, in comparison with some other libraries, (e.g., mpl,
glas), I think value_type<T>::type is more common than value<T>::type, I'll
rename this function in the bindings.

Cheers,

Rutger