diff --git a/include/boost/mpl/assert.hpp b/include/boost/mpl/assert.hpp index bdf7957..4d860a4 100644 --- a/include/boost/mpl/assert.hpp +++ b/include/boost/mpl/assert.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -55,7 +56,7 @@ // and GCC (which issues "unused variable" warnings when static constants are used // at a function scope) #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \ - || (BOOST_MPL_CFG_GCC != 0) + || (BOOST_MPL_CFG_GCC != 0) || (BOOST_MPL_CFG_GPU != 0) # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr } #else # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) BOOST_STATIC_CONSTANT(T, expr) diff --git a/include/boost/mpl/aux_/config/gpu.hpp b/include/boost/mpl/aux_/config/gpu.hpp new file mode 100644 index 0000000..0e5ed78 --- /dev/null +++ b/include/boost/mpl/aux_/config/gpu.hpp @@ -0,0 +1,35 @@ + +#ifndef BOOST_MPL_AUX_CONFIG_GPU_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_GPU_HPP_INCLUDED + +// Copyright Eric Niebler 2014 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id$ +// $Date$ +// $Revision$ + +#include + +#if !defined(BOOST_MPL_CFG_GPU_ENABLED) \ + +# define BOOST_MPL_CFG_GPU_ENABLED BOOST_GPU_ENABLED + +#endif + +#if defined __CUDACC__ + +# define BOOST_MPL_CFG_GPU 1 + +#else + +# define BOOST_MPL_CFG_GPU 0 + +#endif + +#endif // BOOST_MPL_AUX_CONFIG_GPU_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/config/operators.hpp b/include/boost/mpl/aux_/config/operators.hpp index 4663b2e..3fb9db3 100644 --- a/include/boost/mpl/aux_/config/operators.hpp +++ b/include/boost/mpl/aux_/config/operators.hpp @@ -24,6 +24,7 @@ || BOOST_WORKAROUND(__EDG_VERSION__, <= 245) \ || BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, <= 0x0295) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) \ + || BOOST_WORKAROUND(__NVCC__, BOOST_TESTED_AT(1)) \ ) # define BOOST_MPL_CFG_USE_OPERATORS_OVERLOADING diff --git a/include/boost/mpl/aux_/unwrap.hpp b/include/boost/mpl/aux_/unwrap.hpp index da2d671..caeb97d 100644 --- a/include/boost/mpl/aux_/unwrap.hpp +++ b/include/boost/mpl/aux_/unwrap.hpp @@ -16,10 +16,12 @@ // $Revision$ #include +#include namespace boost { namespace mpl { namespace aux { template< typename F > +BOOST_MPL_CFG_GPU_ENABLED inline F& unwrap(F& f, long) { @@ -27,6 +29,7 @@ F& unwrap(F& f, long) } template< typename F > +BOOST_MPL_CFG_GPU_ENABLED inline F& unwrap(reference_wrapper& f, int) @@ -35,6 +38,7 @@ unwrap(reference_wrapper& f, int) } template< typename F > +BOOST_MPL_CFG_GPU_ENABLED inline F& unwrap(reference_wrapper const& f, int) diff --git a/include/boost/mpl/for_each.hpp b/include/boost/mpl/for_each.hpp index 66fd01b..6b40ce1 100644 --- a/include/boost/mpl/for_each.hpp +++ b/include/boost/mpl/for_each.hpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ struct for_each_impl , typename TransformFunc , typename F > + BOOST_MPL_CFG_GPU_ENABLED static void execute( Iterator* , LastIterator* @@ -59,6 +61,7 @@ struct for_each_impl , typename TransformFunc , typename F > + BOOST_MPL_CFG_GPU_ENABLED static void execute( Iterator* , LastIterator* @@ -89,6 +92,7 @@ template< , typename TransformOp , typename F > +BOOST_MPL_CFG_GPU_ENABLED inline void for_each(F f, Sequence* = 0, TransformOp* = 0) { @@ -105,6 +109,7 @@ template< typename Sequence , typename F > +BOOST_MPL_CFG_GPU_ENABLED inline void for_each(F f, Sequence* = 0) { diff --git a/include/boost/mpl/print.hpp b/include/boost/mpl/print.hpp index 4281822..e3b0d31 100644 --- a/include/boost/mpl/print.hpp +++ b/include/boost/mpl/print.hpp @@ -37,8 +37,7 @@ namespace aux { static const unsigned value = 1; }; #endif -} // namespace aux - +} // namespace aux template struct print @@ -47,7 +46,9 @@ struct print , aux::print_base #endif { -#if defined(BOOST_MSVC) +#if defined(__clang__) + const int m_x = 1 / (sizeof(T) - sizeof(T)); +#elif defined(BOOST_MSVC) enum { n = sizeof(T) + -1 }; #elif defined(__MWERKS__) void f(int);