forked from boostorg/fusion
More constexpr and noexcept support.
Note 1: Forwarding functions are specified as a C++14 constexpr since std::forward is not a constexpr within C++11. Note 2: Though I'm not sure why it doesn't compile, some declarations are specified as a C++14 constexpr or non-constexpr. Note 3: Boost.Tuple adaptation and TR1-based tuple implementations are not constexpr.
This commit is contained in:
@ -29,51 +29,47 @@ namespace boost { namespace fusion
|
||||
template <typename First, typename Second>
|
||||
struct pair
|
||||
{
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair()
|
||||
: second() {}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair(pair const& rhs)
|
||||
: second(rhs.second) {}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair(pair&& rhs)
|
||||
: second(BOOST_FUSION_FWD_ELEM(Second, rhs.second)) {}
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair(typename detail::call_param<Second>::type val)
|
||||
: second(val) {}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
template <typename Second2>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair(Second2&& val
|
||||
, typename boost::disable_if<is_lvalue_reference<Second2> >::type* /* dummy */ = 0
|
||||
, typename boost::enable_if<is_convertible<Second2, Second> >::type* /*dummy*/ = 0
|
||||
) : second(BOOST_FUSION_FWD_ELEM(Second, val)) {}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename Second2>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair(pair<First, Second2> const& rhs)
|
||||
: second(rhs.second) {}
|
||||
|
||||
template <typename Second2>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair& operator=(pair<First, Second2> const& rhs)
|
||||
{
|
||||
second = rhs.second;
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair& operator=(pair const& rhs)
|
||||
{
|
||||
second = rhs.second;
|
||||
@ -81,7 +77,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
pair& operator=(pair&& rhs)
|
||||
{
|
||||
second = BOOST_FUSION_FWD_ELEM(Second, rhs.second);
|
||||
@ -117,7 +113,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename First, typename Second>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::make_pair<First,Second>::type
|
||||
make_pair(Second const& val)
|
||||
{
|
||||
@ -141,7 +137,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename First, typename SecondL, typename SecondR>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline bool
|
||||
operator==(pair<First, SecondL> const& l, pair<First, SecondR> const& r)
|
||||
{
|
||||
@ -149,7 +145,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename First, typename SecondL, typename SecondR>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline bool
|
||||
operator!=(pair<First, SecondL> const& l, pair<First, SecondR> const& r)
|
||||
{
|
||||
@ -157,7 +153,7 @@ namespace boost { namespace fusion
|
||||
}
|
||||
|
||||
template <typename First, typename SecondL, typename SecondR>
|
||||
BOOST_FUSION_GPU_ENABLED
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline bool
|
||||
operator<(pair<First, SecondL> const& l, pair<First, SecondR> const& r)
|
||||
{
|
||||
|
Reference in New Issue
Block a user