comparison DEPENDENCIES/generic/include/boost/fusion/sequence/intrinsic/swap.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/ 7 ==============================================================================*/
8 #if !defined(BOOST_FUSION_SWAP_20070501_1956) 8 #if !defined(BOOST_FUSION_SWAP_20070501_1956)
9 #define BOOST_FUSION_SWAP_20070501_1956 9 #define BOOST_FUSION_SWAP_20070501_1956
10 10
11 #include <boost/fusion/support/config.hpp>
11 #include <algorithm> 12 #include <algorithm>
12 13
13 #include <boost/fusion/support/is_sequence.hpp> 14 #include <boost/fusion/support/is_sequence.hpp>
14 #include <boost/fusion/view/zip_view.hpp> 15 #include <boost/fusion/view/zip_view.hpp>
15 #include <boost/fusion/algorithm/iteration/for_each.hpp> 16 #include <boost/fusion/algorithm/iteration/for_each.hpp>
16 #include <boost/utility/enable_if.hpp>
17 #include <boost/fusion/sequence/intrinsic/front.hpp> 17 #include <boost/fusion/sequence/intrinsic/front.hpp>
18 #include <boost/fusion/sequence/intrinsic/back.hpp> 18 #include <boost/fusion/sequence/intrinsic/back.hpp>
19 #include <boost/core/enable_if.hpp>
19 #include <boost/mpl/and.hpp> 20 #include <boost/mpl/and.hpp>
20 21
21 namespace boost { namespace fusion { 22 namespace boost { namespace fusion {
23
22 namespace result_of 24 namespace result_of
23 { 25 {
24 template<typename Seq1, typename Seq2> 26 template<typename Seq1, typename Seq2>
25 struct swap 27 struct swap
26 { 28 : enable_if<mpl::and_<
27 typedef void type; 29 traits::is_sequence<Seq1>,
28 }; 30 traits::is_sequence<Seq2>
31 > > {};
29 } 32 }
30 33
31 namespace detail 34 namespace detail
32 { 35 {
33 struct swap 36 struct swap
37 { 40 {
38 typedef void type; 41 typedef void type;
39 }; 42 };
40 43
41 template<typename Elem> 44 template<typename Elem>
45 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
42 void operator()(Elem const& e) const 46 void operator()(Elem const& e) const
43 { 47 {
44 using std::swap; 48 using std::swap;
45 swap(front(e), back(e)); 49 swap(front(e), back(e));
46 } 50 }
47 }; 51 };
48 } 52 }
49 53
50 template<typename Seq1, typename Seq2> 54 template<typename Seq1, typename Seq2>
51 typename enable_if<mpl::and_<traits::is_sequence<Seq1>, traits::is_sequence<Seq2> >, void>::type 55 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
56 inline typename result_of::swap<Seq1, Seq2>::type
52 swap(Seq1& lhs, Seq2& rhs) 57 swap(Seq1& lhs, Seq2& rhs)
53 { 58 {
54 typedef vector<Seq1&, Seq2&> references; 59 typedef vector<Seq1&, Seq2&> references;
55 for_each(zip_view<references>(references(lhs, rhs)), detail::swap()); 60 for_each(zip_view<references>(references(lhs, rhs)), detail::swap());
56 } 61 }