Boost logo

Ublas :

Subject: [ublas] ublas/blas bindings-v2 storage adaptor patch
From: Andrey Asadchev (asadchev_at_[hidden])
Date: 2011-03-01 00:06:39


--- bindings/ublas/storage.hpp (revision 239)
+++ bindings/ublas/storage.hpp (working copy)
@@ -12,15 +12,20 @@
 #include <boost/numeric/bindings/detail/adaptor.hpp>
 #include <boost/numeric/ublas/storage.hpp>

+#include <boost/type_traits/is_base_of.hpp>
+
 namespace boost {
 namespace numeric {
 namespace bindings {
 namespace detail {

-template< typename T, std::size_t N, typename Alloc, typename Id, typename
Enable >
-struct adaptor< ::boost::numeric::ublas::bounded_array< T, N, Alloc >, Id,
Enable > {
+template<class A, typename Id>
+struct adaptor<A, Id, typename boost::enable_if<
+ boost::is_base_of<
+ ublas::storage_array<A>, A> >::type>
+{

- typedef typename copy_const< Id, T >::type value_type;
+ typedef typename copy_const< Id, typename A::value_type >::type
value_type;
     typedef mpl::map<
         mpl::pair< tag::value_type, value_type >,
         mpl::pair< tag::entity, tag::vector >,
@@ -43,60 +48,6 @@

 };

-template< typename T, typename Alloc, typename Id, typename Enable >
-struct adaptor< ublas::unbounded_array< T, Alloc >, Id, Enable > {
-
- typedef typename copy_const< Id, T >::type value_type;
- typedef mpl::map<
- mpl::pair< tag::value_type, value_type >,
- mpl::pair< tag::entity, tag::vector >,
- mpl::pair< tag::size_type<1>, std::ptrdiff_t >,
- mpl::pair< tag::data_structure, tag::linear_array >,
- mpl::pair< tag::stride_type<1>, tag::contiguous >
- > property_map;
-
- static std::ptrdiff_t size1( const Id& id ) {
- return id.size();
- }
-
- static value_type* begin_value( Id& id ) {
- return id.begin();
- }
-
- static value_type* end_value( Id& id ) {
- return id.end();
- }
-
-};