Chris@102: /*============================================================================= Chris@102: Copyright (c) 2014 Eric Niebler Chris@102: Copyright (c) 2014 Kohei Takahashi Chris@102: Chris@102: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@102: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@102: ==============================================================================*/ Chris@102: #if !defined(FUSION_SUPPORT_CONFIG_01092014_1718) Chris@102: #define FUSION_SUPPORT_CONFIG_01092014_1718 Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: #ifndef BOOST_FUSION_GPU_ENABLED Chris@102: #define BOOST_FUSION_GPU_ENABLED BOOST_GPU_ENABLED Chris@102: #endif Chris@102: Chris@102: // Enclose with inline namespace because unqualified lookup of GCC < 4.5 is broken. Chris@102: // Chris@102: // namespace detail { Chris@102: // struct foo; Chris@102: // struct X { }; Chris@102: // } Chris@102: // Chris@102: // template void foo(T) { } Chris@102: // Chris@102: // int main() Chris@102: // { Chris@102: // foo(detail::X()); Chris@102: // // prog.cc: In function 'int main()': Chris@102: // // prog.cc:2: error: 'struct detail::foo' is not a function, Chris@102: // // prog.cc:6: error: conflict with 'template void foo(T)' Chris@102: // // prog.cc:10: error: in call to 'foo' Chris@102: // } Chris@102: namespace boost { namespace fusion { namespace detail Chris@102: { Chris@102: namespace barrier { } Chris@102: using namespace barrier; Chris@102: }}} Chris@102: #define BOOST_FUSION_BARRIER_BEGIN namespace barrier { Chris@102: #define BOOST_FUSION_BARRIER_END } Chris@102: Chris@102: Chris@102: #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900)) Chris@102: // All of rvalue-reference ready MSVC don't perform implicit conversion from Chris@102: // fundamental type to rvalue-reference of another fundamental type [1]. Chris@102: // Chris@102: // Following example doesn't compile Chris@102: // Chris@102: // int i; Chris@102: // long &&l = i; // sigh..., std::forward(i) also fail. Chris@102: // Chris@102: // however, following one will work. Chris@102: // Chris@102: // int i; Chris@102: // long &&l = static_cast(i); Chris@102: // Chris@102: // OK, now can we replace all usage of std::forward to static_cast? -- I say NO! Chris@102: // All of rvalue-reference ready Clang doesn't compile above static_cast usage [2], sigh... Chris@102: // Chris@102: // References: Chris@102: // 1. https://connect.microsoft.com/VisualStudio/feedback/details/1037806/implicit-conversion-doesnt-perform-for-fund Chris@102: // 2. http://llvm.org/bugs/show_bug.cgi?id=19917 Chris@102: // Chris@102: // Tentatively, we use static_cast to forward if run under MSVC. Chris@102: # define BOOST_FUSION_FWD_ELEM(type, value) static_cast(value) Chris@102: #else Chris@102: # define BOOST_FUSION_FWD_ELEM(type, value) std::forward(value) Chris@102: #endif Chris@102: Chris@102: Chris@102: // Workaround for LWG 2408: C++17 SFINAE-friendly std::iterator_traits. Chris@102: // http://cplusplus.github.io/LWG/lwg-defects.html#2408 Chris@102: // Chris@102: // - GCC 4.5 enables the feature under C++11. Chris@102: // https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01105.html Chris@102: // Chris@102: // - MSVC 10.0 implements iterator intrinsics; MSVC 13.0 implements LWG2408. Chris@102: #if (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 40500) && \ Chris@102: defined(BOOST_LIBSTDCXX11)) || \ Chris@102: (defined(BOOST_MSVC) && (1600 <= BOOST_MSVC || BOOST_MSVC < 1900)) Chris@102: # define BOOST_FUSION_WORKAROUND_FOR_LWG_2408 Chris@102: namespace std Chris@102: { Chris@102: template Chris@102: struct iterator_traits; Chris@102: } Chris@102: #endif Chris@102: Chris@102: #endif