mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-01 05:44:37 +02:00
@@ -25,6 +25,7 @@
|
||||
#include <boost/mpl/aux_/config/dtp.hpp>
|
||||
#include <boost/mpl/aux_/config/gcc.hpp>
|
||||
#include <boost/mpl/aux_/config/msvc.hpp>
|
||||
#include <boost/mpl/aux_/config/gpu.hpp>
|
||||
#include <boost/mpl/aux_/config/static_constant.hpp>
|
||||
#include <boost/mpl/aux_/config/pp_counter.hpp>
|
||||
#include <boost/mpl/aux_/config/workaround.hpp>
|
||||
@@ -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)
|
||||
|
35
include/boost/mpl/aux_/config/gpu.hpp
Normal file
35
include/boost/mpl/aux_/config/gpu.hpp
Normal file
@@ -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 <boost/config.hpp>
|
||||
|
||||
#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
|
@@ -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
|
||||
|
@@ -16,10 +16,12 @@
|
||||
// $Revision$
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/mpl/aux_/config/gpu.hpp>
|
||||
|
||||
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>& f, int)
|
||||
@@ -35,6 +38,7 @@ unwrap(reference_wrapper<F>& f, int)
|
||||
}
|
||||
|
||||
template< typename F >
|
||||
BOOST_MPL_CFG_GPU_ENABLED
|
||||
inline
|
||||
F&
|
||||
unwrap(reference_wrapper<F> const& f, int)
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/aux_/config/gpu.hpp>
|
||||
#include <boost/mpl/aux_/unwrap.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
@@ -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<false>
|
||||
, 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)
|
||||
{
|
||||
|
@@ -37,8 +37,7 @@ namespace aux {
|
||||
static const unsigned value = 1;
|
||||
};
|
||||
#endif
|
||||
} // namespace aux
|
||||
|
||||
} // namespace aux
|
||||
|
||||
template <class T>
|
||||
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);
|
||||
|
Reference in New Issue
Block a user