Files
boost_fusion/include/boost/fusion/support/config.hpp

72 lines
2.4 KiB
C++
Raw Normal View History

2014-01-09 17:58:06 -08:00
/*=============================================================================
Copyright (c) 2014 Eric Niebler
Copyright (c) 2014 Kohei Takahashi
2014-01-09 17:58:06 -08:00
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)
==============================================================================*/
#if !defined(FUSION_SUPPORT_CONFIG_01092014_1718)
#define FUSION_SUPPORT_CONFIG_01092014_1718
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
2014-01-09 17:58:06 -08:00
#ifndef BOOST_FUSION_GPU_ENABLED
#define BOOST_FUSION_GPU_ENABLED BOOST_GPU_ENABLED
#endif
// Enclose with inline namespace because unqualified lookup of GCC < 4.5 is broken.
//
// namespace detail {
// struct foo;
// struct X { };
// }
//
// template <typename T> void foo(T) { }
//
// int main()
// {
// foo(detail::X());
// // prog.cc: In function 'int main()':
// // prog.cc:2: error: 'struct detail::foo' is not a function,
// // prog.cc:6: error: conflict with 'template<class T> void foo(T)'
// // prog.cc:10: error: in call to 'foo'
// }
namespace boost { namespace fusion { namespace detail
{
namespace barrier { }
using namespace barrier;
}}}
#define BOOST_FUSION_BARRIER_BEGIN namespace barrier {
#define BOOST_FUSION_BARRIER_END }
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900))
// All of rvalue-reference ready MSVC don't perform implicit conversion from
// fundamental type to rvalue-reference of another fundamental type [1].
//
// Following example doesn't compile
//
// int i;
// long &&l = i; // sigh..., std::forward<long&&>(i) also fail.
//
// however, following one will work.
//
// int i;
// long &&l = static_cast<long &&>(i);
//
// OK, now can we replace all usage of std::forward to static_cast? -- I say NO!
// All of rvalue-reference ready Clang doesn't compile above static_cast usage [2], sigh...
//
// References:
// 1. https://connect.microsoft.com/VisualStudio/feedback/details/1037806/implicit-conversion-doesnt-perform-for-fund
// 2. http://llvm.org/bugs/show_bug.cgi?id=19917
//
// Tentatively, we use static_cast to forward if run under MSVC.
# define BOOST_FUSION_FWD_ELEM(type, value) static_cast<type&&>(value)
#else
# define BOOST_FUSION_FWD_ELEM(type, value) std::forward<type>(value)
#endif
2014-01-09 17:58:06 -08:00
#endif