From b64850c843019edddc4ca44736cf1c91c35ca377 Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Fri, 17 Sep 2004 15:58:33 +0000 Subject: [PATCH] quick fix for VC6 mapped_type problem --- include/boost/numeric/ublas/matrix_sparse.hpp | 4 ++-- include/boost/numeric/ublas/storage_sparse.hpp | 15 +++++++++++---- include/boost/numeric/ublas/vector_sparse.hpp | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/boost/numeric/ublas/matrix_sparse.hpp b/include/boost/numeric/ublas/matrix_sparse.hpp index 7b6773e0..6df4b31b 100644 --- a/include/boost/numeric/ublas/matrix_sparse.hpp +++ b/include/boost/numeric/ublas/matrix_sparse.hpp @@ -240,7 +240,7 @@ namespace boost { namespace numeric { namespace ublas { typedef A array_type; typedef const T &const_reference; #ifndef BOOST_UBLAS_STRICT_MATRIX_SPARSE - typedef BOOST_UBLAS_TYPENAME detail::map_traits::reference reference; + typedef BOOST_UBLAS_TYPENAME detail::map_traits::reference reference; #else typedef sparse_matrix_element > reference; #endif @@ -1295,7 +1295,7 @@ namespace boost { namespace numeric { namespace ublas { typedef T value_type; typedef const T &const_reference; #ifndef BOOST_UBLAS_STRICT_MATRIX_SPARSE - typedef typename detail::map_traits::reference reference; + typedef typename detail::map_traits::reference reference; #else typedef sparse_matrix_element > reference; #endif diff --git a/include/boost/numeric/ublas/storage_sparse.hpp b/include/boost/numeric/ublas/storage_sparse.hpp index 7c91164d..1c5bab41 100644 --- a/include/boost/numeric/ublas/storage_sparse.hpp +++ b/include/boost/numeric/ublas/storage_sparse.hpp @@ -562,17 +562,24 @@ namespace boost { namespace numeric { namespace ublas { }; namespace detail { - template +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template struct map_traits { typedef BOOST_UBLAS_TYPENAME A::mapped_type &reference; }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template - struct map_traits > { + struct map_traits, T > { typedef typename map_array::data_reference reference; }; -#elif defined (BOOST_UBLAS_STRICT_MAP_ARRAY) +#else +#if defined (BOOST_UBLAS_STRICT_MAP_ARRAY) #error BOOST_UBLAS_STRICT_MAP_ARRAY require partial template speciazation +#endif + // ISSUE: T is actually only required for VC6 as it can't find mapped_type + template + struct map_traits { + typedef T &reference; + }; #endif // reserve helpers for map_array and generic maps diff --git a/include/boost/numeric/ublas/vector_sparse.hpp b/include/boost/numeric/ublas/vector_sparse.hpp index 6528ca2a..d90c5e7f 100644 --- a/include/boost/numeric/ublas/vector_sparse.hpp +++ b/include/boost/numeric/ublas/vector_sparse.hpp @@ -235,7 +235,7 @@ namespace boost { namespace numeric { namespace ublas { typedef A array_type; typedef const value_type &const_reference; #ifndef BOOST_UBLAS_STRICT_VECTOR_SPARSE - typedef BOOST_UBLAS_TYPENAME detail::map_traits::reference reference; + typedef BOOST_UBLAS_TYPENAME detail::map_traits::reference reference; #else typedef sparse_vector_element > reference; #endif