diff options
Diffstat (limited to 'boost/fusion/support/pair.hpp')
-rw-r--r-- | boost/fusion/support/pair.hpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/boost/fusion/support/pair.hpp b/boost/fusion/support/pair.hpp index 11ad1ffe7e..c547926e9b 100644 --- a/boost/fusion/support/pair.hpp +++ b/boost/fusion/support/pair.hpp @@ -8,11 +8,14 @@ #if !defined(FUSION_PAIR_07222005_1203) #define FUSION_PAIR_07222005_1203 +#include <boost/fusion/support/config.hpp> #include <iosfwd> #include <boost/fusion/support/detail/access.hpp> #include <boost/fusion/support/detail/as_fusion_element.hpp> #include <boost/config.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_convertible.hpp> #if defined (BOOST_MSVC) # pragma warning(push) @@ -25,23 +28,63 @@ namespace boost { namespace fusion template <typename First, typename Second> struct pair { + BOOST_FUSION_GPU_ENABLED pair() : second() {} + BOOST_FUSION_GPU_ENABLED + pair(pair const& rhs) + : second(rhs.second) {} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + BOOST_FUSION_GPU_ENABLED + pair(pair&& rhs) + : second(std::forward<Second>(rhs.second)) {} +#endif + + BOOST_FUSION_GPU_ENABLED pair(typename detail::call_param<Second>::type val) : second(val) {} +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + template <typename Second2> + BOOST_FUSION_GPU_ENABLED + pair(Second2&& val + , typename boost::enable_if<is_convertible<Second2, Second> >::type* /*dummy*/ = 0 + ) : second(std::forward<Second2>(val)) {} + +#endif + template <typename Second2> + BOOST_FUSION_GPU_ENABLED pair(pair<First, Second2> const& rhs) : second(rhs.second) {} template <typename Second2> + BOOST_FUSION_GPU_ENABLED pair& operator=(pair<First, Second2> const& rhs) { second = rhs.second; return *this; } + BOOST_FUSION_GPU_ENABLED + pair& operator=(pair const& rhs) + { + second = rhs.second; + return *this; + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + BOOST_FUSION_GPU_ENABLED + pair& operator=(pair&& rhs) + { + second = std::forward<Second>(rhs.second); + return *this; + } +#endif + typedef First first_type; typedef Second second_type; Second second; @@ -70,6 +113,7 @@ namespace boost { namespace fusion } template <typename First, typename Second> + BOOST_FUSION_GPU_ENABLED inline typename result_of::make_pair<First,Second>::type make_pair(Second const& val) { @@ -93,6 +137,7 @@ namespace boost { namespace fusion } template <typename First, typename SecondL, typename SecondR> + BOOST_FUSION_GPU_ENABLED inline bool operator==(pair<First, SecondL> const& l, pair<First, SecondR> const& r) { @@ -100,11 +145,20 @@ namespace boost { namespace fusion } template <typename First, typename SecondL, typename SecondR> + BOOST_FUSION_GPU_ENABLED inline bool operator!=(pair<First, SecondL> const& l, pair<First, SecondR> const& r) { return l.second != r.second; } + + template <typename First, typename SecondL, typename SecondR> + BOOST_FUSION_GPU_ENABLED + inline bool + operator<(pair<First, SecondL> const& l, pair<First, SecondR> const& r) + { + return l.second < r.second; + } }} #if defined (BOOST_MSVC) |