annotate DEPENDENCIES/generic/include/boost/assign/ptr_map_inserter.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // Boost.Assign library
Chris@16 2 //
Chris@16 3 // Copyright Thorsten Ottosen 2006. Use, modification and
Chris@16 4 // distribution is subject to the Boost Software License, Version
Chris@16 5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // For more information, see http://www.boost.org/libs/assign/
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASSIGN_PTR_CONTAINER_PTR_MAP_INSERTER_HPP
Chris@16 12 #define BOOST_ASSIGN_PTR_CONTAINER_PTR_MAP_INSERTER_HPP
Chris@16 13
Chris@101 14 #if defined(_MSC_VER)
Chris@16 15 # pragma once
Chris@16 16 #endif
Chris@16 17
Chris@16 18 #include <boost/assign/list_inserter.hpp>
Chris@16 19 #include <boost/type_traits/remove_reference.hpp>
Chris@16 20 #include <boost/type_traits/remove_pointer.hpp>
Chris@16 21
Chris@16 22 namespace boost
Chris@16 23 {
Chris@16 24
Chris@16 25 namespace assign
Chris@16 26 {
Chris@16 27 template< class PtrMap, class Obj >
Chris@16 28 class ptr_map_inserter
Chris@16 29 {
Chris@16 30 typedef BOOST_DEDUCED_TYPENAME
Chris@16 31 remove_pointer< BOOST_DEDUCED_TYPENAME
Chris@16 32 remove_reference<Obj>::type >::type
Chris@16 33 obj_type;
Chris@16 34 typedef BOOST_DEDUCED_TYPENAME PtrMap::key_type
Chris@16 35 key_type;
Chris@16 36
Chris@16 37 public:
Chris@16 38
Chris@16 39 ptr_map_inserter( PtrMap& m ) : m_( m )
Chris@16 40 {}
Chris@16 41
Chris@16 42 template< class Key >
Chris@16 43 ptr_map_inserter& operator()( const Key& t )
Chris@16 44 {
Chris@16 45 key_type k(t);
Chris@16 46 m_.insert( k, new obj_type );
Chris@16 47 return *this;
Chris@16 48 }
Chris@16 49
Chris@16 50 #ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value
Chris@16 51 #define BOOST_ASSIGN_MAX_PARAMS 6
Chris@16 52 #endif
Chris@16 53 #define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1)
Chris@16 54 #define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class T)
Chris@16 55 #define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& t)
Chris@16 56 #define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, t)
Chris@16 57
Chris@16 58 #define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
Chris@16 59 #define BOOST_PP_LOCAL_MACRO(n) \
Chris@16 60 template< class T, BOOST_ASSIGN_PARAMS1(n) > \
Chris@16 61 ptr_map_inserter& operator()( const T& t, BOOST_ASSIGN_PARAMS2(n) ) \
Chris@16 62 { \
Chris@16 63 key_type k(t); \
Chris@16 64 m_.insert( k, new obj_type( BOOST_ASSIGN_PARAMS3(n) ) ); \
Chris@16 65 return *this; \
Chris@16 66 } \
Chris@16 67 /**/
Chris@16 68
Chris@16 69 #include BOOST_PP_LOCAL_ITERATE()
Chris@16 70
Chris@16 71 private:
Chris@16 72
Chris@16 73 ptr_map_inserter& operator=( const ptr_map_inserter& );
Chris@16 74 PtrMap& m_;
Chris@16 75 };
Chris@16 76
Chris@16 77 template< class PtrMap >
Chris@16 78 inline ptr_map_inserter< PtrMap, typename PtrMap::mapped_reference >
Chris@16 79 ptr_map_insert( PtrMap& m )
Chris@16 80 {
Chris@16 81 return ptr_map_inserter< PtrMap, typename PtrMap::mapped_reference >( m );
Chris@16 82 }
Chris@16 83
Chris@16 84 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
Chris@16 85
Chris@16 86 template< class T, class PtrMap >
Chris@16 87 inline ptr_map_inserter< PtrMap, T >
Chris@16 88 ptr_map_insert( PtrMap& m )
Chris@16 89 {
Chris@16 90 return ptr_map_inserter< PtrMap, T >( m );
Chris@16 91 }
Chris@16 92
Chris@16 93 #endif
Chris@16 94
Chris@16 95 } // namespace 'assign'
Chris@16 96 } // namespace 'boost'
Chris@16 97
Chris@16 98 #undef BOOST_ASSIGN_PARAMS1
Chris@16 99 #undef BOOST_ASSIGN_PARAMS2
Chris@16 100 #undef BOOST_ASSIGN_PARAMS3
Chris@16 101 #undef BOOST_ASSIGN_MAX_PARAMETERS
Chris@16 102
Chris@16 103 #endif