Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52490 - sandbox/numeric_bindings/boost/numeric/bindings/traits
From: rutger_at_[hidden]
Date: 2009-04-19 09:14:22


Author: rutger
Date: 2009-04-19 09:14:21 EDT (Sun, 19 Apr 2009)
New Revision: 52490
URL: http://svn.boost.org/trac/boost/changeset/52490

Log:
added more strict specialization of vector_traits

Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/traits/vector_traits.hpp | 15 +++++++++++----
   1 files changed, 11 insertions(+), 4 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/traits/vector_traits.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/traits/vector_traits.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/traits/vector_traits.hpp 2009-04-19 09:14:21 EDT (Sun, 19 Apr 2009)
@@ -15,6 +15,8 @@
 #define BOOST_NUMERIC_BINDINGS_TRAITS_VECTOR_TRAITS_HPP
 
 #include <boost/numeric/bindings/traits/config.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/numeric/bindings/traits/is_numeric.hpp>
 
 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
 
@@ -49,15 +51,20 @@
   // Note that boost::remove_const<VType>::type == VIdentifier.
   template <typename VIdentifier, typename VType>
   struct vector_detail_traits {
- // typedef void value_type;
     typedef VIdentifier identifier_type;
     typedef VType vector_type;
   };
 
- // vector_traits<> generic version:
- template <typename V>
- struct vector_traits : vector_detail_traits< typename boost::remove_const<V>::type, V > {};
+ // vector_traits<> generic version: no specialization(s)
+ template< typename V, typename Enable = void>
+ struct vector_traits {};
 
+ // vector_traits<>, specializes is ::value_type is numeric
+ template <typename V>
+ struct vector_traits< V, typename boost::enable_if<
+ is_numeric< typename vector_detail_traits< typename boost::remove_const<V>::type, V >::value_type >
+ >::type >:
+ vector_detail_traits< typename boost::remove_const<V>::type, V > {};
 
   ///////////////////////////
   //


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk