Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/fusion/container/map/map.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 /*============================================================================= | |
2 Copyright (c) 2001-2011 Joel de Guzman | |
3 | |
4 Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 ==============================================================================*/ | |
7 #if !defined(FUSION_MAP_MAIN_07212005_1106) | |
8 #define FUSION_MAP_MAIN_07212005_1106 | |
9 | |
10 #include <boost/fusion/container/map/map_fwd.hpp> | |
11 #include <boost/fusion/support/pair.hpp> | |
12 | |
13 /////////////////////////////////////////////////////////////////////////////// | |
14 // Without variadics, we will use the PP version | |
15 /////////////////////////////////////////////////////////////////////////////// | |
16 #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP) | |
17 # include <boost/fusion/container/map/detail/cpp03/map.hpp> | |
18 #else | |
19 | |
20 /////////////////////////////////////////////////////////////////////////////// | |
21 // C++11 interface | |
22 /////////////////////////////////////////////////////////////////////////////// | |
23 #include <boost/fusion/container/map/detail/map_impl.hpp> | |
24 #include <boost/fusion/container/map/detail/begin_impl.hpp> | |
25 #include <boost/fusion/container/map/detail/end_impl.hpp> | |
26 #include <boost/fusion/container/map/detail/at_impl.hpp> | |
27 #include <boost/fusion/container/map/detail/at_key_impl.hpp> | |
28 #include <boost/fusion/container/map/detail/value_at_impl.hpp> | |
29 #include <boost/fusion/container/map/detail/value_at_key_impl.hpp> | |
30 #include <boost/fusion/sequence/intrinsic/begin.hpp> | |
31 #include <boost/fusion/sequence/intrinsic/end.hpp> | |
32 #include <boost/fusion/sequence/intrinsic/at.hpp> | |
33 #include <boost/fusion/sequence/intrinsic/at_c.hpp> | |
34 #include <boost/fusion/support/is_sequence.hpp> | |
35 #include <boost/fusion/support/sequence_base.hpp> | |
36 #include <boost/fusion/support/category_of.hpp> | |
37 | |
38 #include <boost/utility/enable_if.hpp> | |
39 | |
40 namespace boost { namespace fusion | |
41 { | |
42 struct map_tag; | |
43 | |
44 template <typename ...T> | |
45 struct map : detail::map_impl<0, T...>, sequence_base<map<T...>> | |
46 { | |
47 typedef map_tag fusion_tag; | |
48 typedef detail::map_impl<0, T...> base_type; | |
49 | |
50 struct category : random_access_traversal_tag, associative_tag {}; | |
51 typedef mpl::int_<base_type::size> size; | |
52 typedef mpl::false_ is_view; | |
53 | |
54 map() {} | |
55 | |
56 map(map const& seq) | |
57 : base_type(seq.base()) | |
58 {} | |
59 | |
60 map(map&& seq) | |
61 : base_type(std::forward<map>(seq)) | |
62 {} | |
63 | |
64 template <typename Sequence> | |
65 map(Sequence const& seq | |
66 , typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0) | |
67 : base_type(begin(seq), detail::map_impl_from_iterator()) | |
68 {} | |
69 | |
70 template <typename Sequence> | |
71 map(Sequence& seq | |
72 , typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0) | |
73 : base_type(begin(seq), detail::map_impl_from_iterator()) | |
74 {} | |
75 | |
76 template <typename Sequence> | |
77 map(Sequence&& seq | |
78 , typename enable_if<traits::is_sequence<Sequence>>::type* /*dummy*/ = 0) | |
79 : base_type(begin(seq), detail::map_impl_from_iterator()) | |
80 {} | |
81 | |
82 template <typename First, typename ...T_> | |
83 map(First const& first, T_ const&... rest) | |
84 : base_type(first, rest...) | |
85 {} | |
86 | |
87 template <typename First, typename ...T_> | |
88 map(First&& first, T_&&... rest) | |
89 : base_type(std::forward<First>(first), std::forward<T_>(rest)...) | |
90 {} | |
91 | |
92 map& operator=(map const& rhs) | |
93 { | |
94 base_type::operator=(rhs.base()); | |
95 return *this; | |
96 } | |
97 | |
98 map& operator=(map&& rhs) | |
99 { | |
100 base_type::operator=(std::forward<base_type>(rhs.base())); | |
101 return *this; | |
102 } | |
103 | |
104 template <typename Sequence> | |
105 typename enable_if<traits::is_sequence<Sequence>, map&>::type | |
106 operator=(Sequence const& seq) | |
107 { | |
108 base().assign(begin(seq), detail::map_impl_from_iterator()); | |
109 return *this; | |
110 } | |
111 | |
112 base_type& base() { return *this; } | |
113 base_type const& base() const { return *this; } | |
114 }; | |
115 }} | |
116 | |
117 #endif | |
118 #endif |