Move libcds 1.6.0 from SVN
[libcds.git] / cds / container / striped_map / boost_flat_map.h
1 //$$CDS-header$$
2
3 #ifndef __CDS_CONTAINER_STRIPED_MAP_BOOST_FLAT_MAP_ADAPTER_H
4 #define __CDS_CONTAINER_STRIPED_MAP_BOOST_FLAT_MAP_ADAPTER_H
5
6 #include <boost/version.hpp>
7 #if BOOST_VERSION < 104800
8 #   error "For boost::container::flat_map you must use boost 1.48 or above"
9 #endif
10
11 #include <cds/container/striped_set/adapter.h>
12 #include <boost/container/flat_map.hpp>
13
14 //#if CDS_COMPILER == CDS_COMPILER_MSVC && CDS_COMPILER_VERSION >= 1700
15 //#   error "boost::container::flat_map is not compatible with MS VC++ 11"
16 //#endif
17
18
19 //@cond
20 namespace cds { namespace container {
21     namespace striped_set {
22
23         // Copy policy for map
24         template <typename Key, typename T, typename Traits, typename Alloc>
25         struct copy_item_policy< boost::container::flat_map< Key, T, Traits, Alloc > >
26             : public details::boost_map_copy_policies<boost::container::flat_map< Key, T, Traits, Alloc > >::copy_item_policy
27         {};
28
29         // Swap item policy
30         template <typename Key, typename T, typename Traits, typename Alloc>
31         struct swap_item_policy< boost::container::flat_map< Key, T, Traits, Alloc > >
32             : public details::boost_map_copy_policies<boost::container::flat_map< Key, T, Traits, Alloc > >::swap_item_policy
33         {};
34
35 #ifdef CDS_MOVE_SEMANTICS_SUPPORT
36         // Move policy for map
37         template <typename Key, typename T, typename Traits, typename Alloc>
38         struct move_item_policy< boost::container::flat_map< Key, T, Traits, Alloc > >
39             : public details::boost_map_copy_policies<boost::container::flat_map< Key, T, Traits, Alloc > >::move_item_policy
40         {};
41 #endif
42     }   // namespace striped_set
43 }} // namespace cds::container
44
45 namespace cds { namespace intrusive { namespace striped_set {
46
47     template <typename Key, typename T, class Traits, class Alloc, CDS_SPEC_OPTIONS>
48     class adapt< boost::container::flat_map< Key, T, Traits, Alloc>, CDS_OPTIONS >
49     {
50     public:
51         typedef boost::container::flat_map< Key, T, Traits, Alloc>     container_type          ;   ///< underlying container type
52         typedef cds::container::striped_set::details::boost_map_adapter< container_type, CDS_OPTIONS >    type;
53     };
54 }}} // namespace cds::intrusive::striped_set
55
56 //@endcond
57
58 #endif // #ifndef __CDS_CONTAINER_STRIPED_MAP_BOOST_FLAT_MAP_ADAPTER_H