Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59801 - sandbox/numeric_bindings/boost/numeric/bindings
From: rutger_at_[hidden]
Date: 2010-02-21 03:48:05


Author: rutger
Date: 2010-02-21 03:48:04 EST (Sun, 21 Feb 2010)
New Revision: 59801
URL: http://svn.boost.org/trac/boost/changeset/59801

Log:
Added a has_static_stride meta-function

Added:
   sandbox/numeric_bindings/boost/numeric/bindings/has_static_stride.hpp (contents, props changed)
Text files modified:
   sandbox/numeric_bindings/boost/numeric/bindings/has_static_size.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: sandbox/numeric_bindings/boost/numeric/bindings/has_static_size.hpp
==============================================================================
--- sandbox/numeric_bindings/boost/numeric/bindings/has_static_size.hpp (original)
+++ sandbox/numeric_bindings/boost/numeric/bindings/has_static_size.hpp 2010-02-21 03:48:04 EST (Sun, 21 Feb 2010)
@@ -25,7 +25,7 @@
 template< int N, int M >
 struct is_static_size_property< mpl::pair< tag::size_type<N>, mpl::int_<M> > >: mpl::true_ {};
 
-}
+} // namespace detail
 
 template< typename T, typename Enable = void >
 struct has_static_size: mpl::false_ {};

Added: sandbox/numeric_bindings/boost/numeric/bindings/has_static_stride.hpp
==============================================================================
--- (empty file)
+++ sandbox/numeric_bindings/boost/numeric/bindings/has_static_stride.hpp 2010-02-21 03:48:04 EST (Sun, 21 Feb 2010)
@@ -0,0 +1,52 @@
+//
+// Copyright (c) 2010 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_HAS_STATIC_STRIDE_HPP
+#define BOOST_NUMERIC_BINDINGS_HAS_STATIC_STRIDE_HPP
+
+#include <boost/numeric/bindings/detail/property_map.hpp>
+#include <boost/numeric/bindings/tag.hpp>
+#include <boost/mpl/count_if.hpp>
+#include <boost/mpl/equal_to.hpp>
+
+namespace boost {
+namespace numeric {
+namespace bindings {
+namespace detail {
+
+template< typename T >
+struct is_static_stride_property: mpl::false_ {};
+
+template< int N, int M >
+struct is_static_stride_property< mpl::pair< tag::stride_type<N>, mpl::int_<M> > >: mpl::true_ {};
+
+} // namespace detail
+
+template< typename T, typename Enable = void >
+struct has_static_stride: mpl::false_ {};
+
+template< typename T >
+struct has_static_stride<
+ T,
+ typename boost::enable_if< detail::is_adaptable<T> >::type >:
+
+ // count the number of static stride properties,
+ // should be equal to the rank of the object
+ mpl::equal_to<
+ mpl::count_if<
+ typename detail::property_map_of< T >::type,
+ detail::is_static_stride_property< mpl::_ >
+ >,
+ typename detail::property_at< T, tag::entity >::type
+ >::type {};
+
+} // namespace bindings
+} // namespace numeric
+} // namespace boost
+
+#endif


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