diff --git a/include/boost/numeric/ublas/storage_sparse.hpp b/include/boost/numeric/ublas/storage_sparse.hpp index fecffb4a..704d5e50 100644 --- a/include/boost/numeric/ublas/storage_sparse.hpp +++ b/include/boost/numeric/ublas/storage_sparse.hpp @@ -123,8 +123,8 @@ namespace boost { namespace numeric { namespace ublas { // typedef const data_value_type &data_const_reference; typedef typename type_traits::const_reference data_const_reference; typedef data_value_type &data_reference; - typedef std::pair value_type; - typedef std::pair *pointer; + typedef typename A::value_type value_type; + typedef value_type *pointer; // Construction and destruction BOOST_UBLAS_INLINE @@ -243,8 +243,9 @@ namespace boost { namespace numeric { namespace ublas { // Default map type is simply forwarded to std::map + // FIXME should use ALLOC for map but std::pair fails template - class map_std : public std::map { + class map_std : public std::map { }; @@ -262,7 +263,7 @@ namespace boost { namespace numeric { namespace ublas { #else typedef sparse_storage_element data_reference; #endif - typedef std::pair value_type; + typedef typename ALLOC::value_type value_type; typedef const value_type &const_reference; typedef value_type &reference; typedef const value_type *const_pointer; @@ -550,8 +551,8 @@ namespace boost { namespace numeric { namespace ublas { private: // Provide destroy as a non member function BOOST_UBLAS_INLINE - void static static_destroy (pointer p) { - p -> ~value_type(); + void static static_destroy (reference p) { + (&p) -> ~value_type (); } ALLOC alloc_; size_type capacity_; @@ -566,44 +567,44 @@ namespace boost { namespace numeric { namespace ublas { template struct map_traits {}; - template - struct map_traits > { - typedef typename map_array::data_reference reference; + template + struct map_traits > { + typedef typename map_array::data_reference reference; }; - template - struct map_traits > { - typedef typename std::map::mapped_type &reference; + template + struct map_traits > { + typedef typename std::map::mapped_type &reference; }; #endif // Some helpers for map_array - template + template BOOST_UBLAS_INLINE - void reserve (map_array &a, typename map_array::size_type capacity) { - a.reserve (capacity); + void reserve (map_array &m, typename map_array::size_type capacity) { + m.reserve (capacity); } #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template + template BOOST_UBLAS_INLINE - typename map_array::data_reference make_reference (map_array &a, typename map_array::iterator it) { + typename map_array::data_reference make_reference (map_array &a, typename map_array::iterator it) { return reference (a, it); } #endif // Some helpers for std::map - template + template BOOST_UBLAS_INLINE - void reserve (std::map &/* a */, typename std::map::size_type /* capacity */) {} + void reserve (std::map &/* m */, typename std::map::size_type /* capacity */) {} #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template + template BOOST_UBLAS_INLINE - typename std::map::mapped_type &make_reference (std::map &/* a */, typename std::map::iterator it) { + typename std::map::mapped_type &make_reference (std::map &/* a */, typename std::map::iterator it) { return (*it).second; } #endif @@ -611,9 +612,9 @@ namespace boost { namespace numeric { namespace ublas { } // This specialization is missing in Dinkumware's STL?! - template + template BOOST_UBLAS_INLINE - void swap (std::map &a1, std::map &a2) { + void swap (std::map &a1, std::map &a2) { if (&a1 != &a2) a1.swap (a2); } @@ -625,7 +626,7 @@ namespace boost { namespace numeric { namespace ublas { // inconsitent value_type zero init // Set array - template + template class set_array { public: typedef std::size_t size_type; @@ -879,9 +880,9 @@ namespace boost { namespace numeric { namespace ublas { }; // This specialization is missing in Dinkumware's STL?! - template + template BOOST_UBLAS_INLINE - void swap (std::set &a1, std::set &a2) { + void swap (std::set &a1, std::set &a2) { if (&a1 != &a2) a1.swap (a2); }