annotate DEPENDENCIES/generic/include/boost/range/mfc_map.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 // Boost.Range library
Chris@102 2 //
Chris@102 3 // Copyright Adam D. Walling 2012. Use, modification and
Chris@102 4 // distribution is subject to the Boost Software License, Version
Chris@102 5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@102 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@102 7 //
Chris@102 8 // For more information, see http://www.boost.org/libs/range/
Chris@102 9 //
Chris@102 10
Chris@102 11 #ifndef BOOST_RANGE_ADAPTOR_MFC_MAP_HPP
Chris@102 12 #define BOOST_RANGE_ADAPTOR_MFC_MAP_HPP
Chris@102 13
Chris@102 14 #if !defined(BOOST_RANGE_MFC_NO_CPAIR)
Chris@102 15
Chris@102 16 #include <boost/range/mfc.hpp>
Chris@102 17 #include <boost/range/adaptor/map.hpp>
Chris@102 18
Chris@102 19 namespace boost
Chris@102 20 {
Chris@102 21 namespace range_detail
Chris@102 22 {
Chris@102 23 // CMap and CMapStringToString range iterators return CPair,
Chris@102 24 // which has a key and value member. Other MFC range iterators
Chris@102 25 // already return adapted std::pair objects. This allows usage
Chris@102 26 // of the map_keys and map_values range adaptors with CMap
Chris@102 27 // and CMapStringToString
Chris@102 28
Chris@102 29 // CPair has a VALUE value member, and a KEY key member; we will
Chris@102 30 // use VALUE& as the result_type consistent with CMap::operator[]
Chris@102 31
Chris@102 32 // specialization for CMap
Chris@102 33 template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
Chris@102 34 struct select_first< CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> >
Chris@102 35 {
Chris@102 36 typedef BOOST_DEDUCED_TYPENAME CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> map_type;
Chris@102 37 typedef BOOST_DEDUCED_TYPENAME range_reference<const map_type>::type argument_type;
Chris@102 38 typedef BOOST_DEDUCED_TYPENAME const KEY& result_type;
Chris@102 39
Chris@102 40 result_type operator()( argument_type r ) const
Chris@102 41 {
Chris@102 42 return r.key;
Chris@102 43 }
Chris@102 44 };
Chris@102 45
Chris@102 46 template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
Chris@102 47 struct select_second_mutable< CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> >
Chris@102 48 {
Chris@102 49 typedef BOOST_DEDUCED_TYPENAME CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> map_type;
Chris@102 50 typedef BOOST_DEDUCED_TYPENAME range_reference<map_type>::type argument_type;
Chris@102 51 typedef BOOST_DEDUCED_TYPENAME VALUE& result_type;
Chris@102 52
Chris@102 53 result_type operator()( argument_type r ) const
Chris@102 54 {
Chris@102 55 return r.value;
Chris@102 56 }
Chris@102 57 };
Chris@102 58
Chris@102 59 template<class KEY, class ARG_KEY, class VALUE, class ARG_VALUE>
Chris@102 60 struct select_second_const< CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> >
Chris@102 61 {
Chris@102 62 typedef BOOST_DEDUCED_TYPENAME CMap<KEY, ARG_KEY, VALUE, ARG_VALUE> map_type;
Chris@102 63 typedef BOOST_DEDUCED_TYPENAME range_reference<const map_type>::type argument_type;
Chris@102 64 typedef BOOST_DEDUCED_TYPENAME const VALUE& result_type;
Chris@102 65
Chris@102 66 result_type operator()( argument_type r ) const
Chris@102 67 {
Chris@102 68 return r.value;
Chris@102 69 }
Chris@102 70 };
Chris@102 71
Chris@102 72
Chris@102 73 // specialization for CMapStringToString
Chris@102 74 template<>
Chris@102 75 struct select_first< CMapStringToString >
Chris@102 76 {
Chris@102 77 typedef range_reference<const CMapStringToString>::type argument_type;
Chris@102 78 typedef const CString& result_type;
Chris@102 79
Chris@102 80 result_type operator()( argument_type r ) const
Chris@102 81 {
Chris@102 82 return r.key;
Chris@102 83 }
Chris@102 84 };
Chris@102 85
Chris@102 86 template<>
Chris@102 87 struct select_second_mutable< CMapStringToString >
Chris@102 88 {
Chris@102 89 typedef range_reference<CMapStringToString>::type argument_type;
Chris@102 90 typedef CString& result_type;
Chris@102 91
Chris@102 92 result_type operator()( argument_type r ) const
Chris@102 93 {
Chris@102 94 return r.value;
Chris@102 95 }
Chris@102 96 };
Chris@102 97
Chris@102 98 template<>
Chris@102 99 struct select_second_const< CMapStringToString >
Chris@102 100 {
Chris@102 101 typedef range_reference<const CMapStringToString>::type argument_type;
Chris@102 102 typedef const CString& result_type;
Chris@102 103
Chris@102 104 result_type operator()( argument_type r ) const
Chris@102 105 {
Chris@102 106 return r.value;
Chris@102 107 }
Chris@102 108 };
Chris@102 109 } // 'range_detail'
Chris@102 110 } // 'boost'
Chris@102 111
Chris@102 112 #endif // !defined(BOOST_RANGE_MFC_NO_CPAIR)
Chris@102 113
Chris@102 114 #endif