summaryrefslogtreecommitdiff
path: root/boost/numeric/ublas/storage.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/numeric/ublas/storage.hpp')
-rw-r--r--boost/numeric/ublas/storage.hpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/boost/numeric/ublas/storage.hpp b/boost/numeric/ublas/storage.hpp
index 9dfaaee07..8821309dd 100644
--- a/boost/numeric/ublas/storage.hpp
+++ b/boost/numeric/ublas/storage.hpp
@@ -370,7 +370,7 @@ namespace boost { namespace numeric { namespace ublas {
// Random Access Container
BOOST_UBLAS_INLINE
size_type max_size () const {
- return ALLOC ().max_size();
+ return N;
}
BOOST_UBLAS_INLINE
@@ -537,6 +537,10 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
array_adaptor (size_type size, pointer data):
size_ (size), own_ (false), data_ (data) {}
+
+ template <size_t N>
+ BOOST_UBLAS_INLINE array_adaptor (T (&data)[N]):
+ size_ (N), own_ (false), data_ (data) {}
BOOST_UBLAS_INLINE
array_adaptor (const array_adaptor &a):
storage_array<self_type> (),
@@ -602,6 +606,16 @@ namespace boost { namespace numeric { namespace ublas {
resize_internal (size, data, init, true);
}
+ template <size_t N>
+ BOOST_UBLAS_INLINE void resize (T (&data)[N]) {
+ resize_internal (N, data, value_type (), false);
+ }
+
+ template <size_t N>
+ BOOST_UBLAS_INLINE void resize (T (&data)[N], value_type init) {
+ resize_internal (N, data, init, true);
+ }
+
BOOST_UBLAS_INLINE
size_type size () const {
return size_;
@@ -734,7 +748,7 @@ namespace boost { namespace numeric { namespace ublas {
typedef TT *argument_type;
BOOST_UBLAS_INLINE
- result_type operator () (argument_type x) {}
+ result_type operator () (argument_type /* x */) {}
};
public:
@@ -763,6 +777,10 @@ namespace boost { namespace numeric { namespace ublas {
BOOST_UBLAS_INLINE
shallow_array_adaptor (size_type size, pointer data):
size_ (size), own_ (false), data_ (data, leaker<value_type> ()) {}
+ BOOST_UBLAS_INLINE
+ template <size_t N>
+ shallow_array_adaptor (T (&data)[N]):
+ size_ (N), own_ (false), data_ (data, leaker<value_type> ()) {}
BOOST_UBLAS_INLINE
shallow_array_adaptor (const shallow_array_adaptor &a):
@@ -784,6 +802,7 @@ namespace boost { namespace numeric { namespace ublas {
std::fill (data.get () + (std::min) (size, size_), data.get () + size, init);
}
size_ = size;
+ own_ = true;
data_ = data;
}
}
@@ -794,7 +813,8 @@ namespace boost { namespace numeric { namespace ublas {
std::fill (data + (std::min) (size, size_), data + size, init);
}
size_ = size;
- data_ = data;
+ own_ = false;
+ data_.reset(data, leaker<value_type> ());
}
public:
BOOST_UBLAS_INLINE
@@ -813,6 +833,16 @@ namespace boost { namespace numeric { namespace ublas {
void resize (size_type size, pointer data, value_type init) {
resize_internal (size, data, init, true);
}
+ BOOST_UBLAS_INLINE
+ template <size_t N>
+ void resize (T (&data)[N]) {
+ resize_internal (N, data, value_type (), false);
+ }
+ BOOST_UBLAS_INLINE
+ template <size_t N>
+ void resize (T (&data)[N], value_type init) {
+ resize_internal (N, data, init, true);
+ }
BOOST_UBLAS_INLINE
size_type size () const {