Changeset 2423:02fedd6652c6 in lemon-0.x for lemon
- Timestamp:
- 04/19/07 17:09:08 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3259
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/maps.h
r2391 r2423 1045 1045 return NotMap<M>(m); 1046 1046 } 1047 1047 1048 1048 template <typename M> 1049 1049 inline NotWriteMap<M> notMap(M &m) { … … 1052 1052 1053 1053 namespace _maps_bits { 1054 1054 1055 template <typename Value> 1055 1056 struct Identity { 1056 1057 typedef Value argument_type; 1057 1058 typedef Value result_type; 1058 Value operator()(const Value& val) {1059 Value operator()(const Value& val) const { 1059 1060 return val; 1060 1061 } 1061 1062 }; 1063 1064 template <typename _Iterator, typename Enable = void> 1065 struct IteratorTraits { 1066 typedef typename std::iterator_traits<_Iterator>::value_type Value; 1067 }; 1068 1069 template <typename _Iterator> 1070 struct IteratorTraits<_Iterator, 1071 typename exists<typename _Iterator::container_type>::type> 1072 { 1073 typedef typename _Iterator::container_type::value_type Value; 1074 }; 1075 1062 1076 } 1063 1077 … … 1086 1100 ///\endcode 1087 1101 template <typename _Iterator, 1088 typename _Functor = 1089 _maps_bits::Identity<typename std::iterator_traits<_Iterator>::value_type> > 1102 typename _Functor = 1103 _maps_bits::Identity<typename _maps_bits:: 1104 IteratorTraits<_Iterator>::Value> > 1090 1105 class StoreBoolMap { 1091 1106 public: … … 1112 1127 1113 1128 /// Setter function of the map 1114 void set(const Key& key, Value value) {1129 void set(const Key& key, Value value) const { 1115 1130 if (value) { 1116 1131 *_end++ = _functor(key); … … 1119 1134 1120 1135 private: 1121 Iterator _begin, _end; 1136 Iterator _begin; 1137 mutable Iterator _end; 1122 1138 Functor _functor; 1123 1139 };
Note: See TracChangeset
for help on using the changeset viewer.