|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52489 - sandbox/numeric_bindings/boost/numeric/bindings/traits
From: rutger_at_[hidden]
Date: 2009-04-19 09:05:37
Author: rutger
Date: 2009-04-19 09:05:36 EDT (Sun, 19 Apr 2009)
New Revision: 52489
URL: http://svn.boost.org/trac/boost/changeset/52489
Log:
Added is_numeric to bindings/traits
Added:
sandbox/numeric_bindings/boost/numeric/bindings/traits/is_numeric.hpp (contents, props changed)
Text files modified:
sandbox/numeric_bindings/boost/numeric/bindings/traits/is_real.hpp | 13 ++-----------
sandbox/numeric_bindings/boost/numeric/bindings/traits/vector_traits.hpp | 6 +++---
2 files changed, 5 insertions(+), 14 deletions(-)
Added: sandbox/numeric_bindings/boost/numeric/bindings/traits/is_numeric.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/traits/is_numeric.hpp 2009-04-19 09:05:36 EDT (Sun, 19 Apr 2009)
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2009 by Rutger ter Borg
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BOOST_NUMERIC_BINDINGS_TRAITS_IS_NUMERIC_HPP
+#define BOOST_NUMERIC_BINDINGS_TRAITS_IS_NUMERIC_HPP
+
+#include <boost/mpl/or.hpp>
+#include <boost/numeric/bindings/traits/is_real.hpp>
+#include <boost/numeric/bindings/traits/is_complex.hpp>
+#include <boost/type_traits/is_integral.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace traits {
+
+template< typename T >
+struct is_numeric: mpl::or_< is_real<T>, is_complex<T>, is_integral<T> > {};
+
+}}}}
+
+#endif
Modified: sandbox/numeric_bindings/boost/numeric/bindings/traits/is_real.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/traits/is_real.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/traits/is_real.hpp 2009-04-19 09:05:36 EDT (Sun, 19 Apr 2009)
@@ -9,7 +9,7 @@
#ifndef BOOST_NUMERIC_BINDINGS_TRAITS_IS_REAL_HPP
#define BOOST_NUMERIC_BINDINGS_TRAITS_IS_REAL_HPP
-#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
namespace boost {
namespace numeric {
@@ -17,16 +17,7 @@
namespace traits {
template< typename T >
-struct is_real: boost::mpl::bool_<false> {};
-
-template<>
-struct is_real< float >: boost::mpl::bool_<true> {};
-
-template<>
-struct is_real< double >: boost::mpl::bool_<true> {};
-
-template<>
-struct is_real< long double >: boost::mpl::bool_<true> {};
+struct is_real: boost::is_floating_point<T> {};
}}}}
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:05:36 EDT (Sun, 19 Apr 2009)
@@ -48,13 +48,13 @@
// e.g. vector_detail_traits< std::vector<int>, std::vector<int> >
// Note that boost::remove_const<VType>::type == VIdentifier.
template <typename VIdentifier, typename VType>
- struct vector_detail_traits : default_vector_traits<VType, typename VType::value_type >
- {
+ struct vector_detail_traits {
+ // typedef void value_type;
typedef VIdentifier identifier_type;
typedef VType vector_type;
};
- // vector_traits<> generic version:
+ // vector_traits<> generic version:
template <typename V>
struct vector_traits : 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