1 #ifndef CASM_unique_map_HH
2 #define CASM_unique_map_HH
18 template <
typename TransformFunc,
typename MapIteratorType>
23 typedef typename std::result_of<TransformFunc(
25 typedef typename std::remove_reference<reference>::type
value_type;
33 template <
typename T,
typename M>
37 template <
typename T,
typename M>
39 return (!
operator!=(B));
42 template <
typename T,
typename M>
86 template <
typename MapType>
88 typedef typename MapType::iterator::reference
reference;
89 typedef typename MapType::iterator::value_type::second_type &
result_type;
96 template <
typename MapType>
98 typedef typename MapType::const_iterator::reference
reference;
99 typedef const typename MapType::const_iterator::value_type::second_type
120 template <
typename KeyType,
typename ValueType,
121 typename MapType = std::map<KeyType, ValueType>,
122 typename TransformFunction = GetSecond<MapType>,
123 typename ConstTransformFunction = GetSecondConst<MapType> >
129 typedef std::function<
typename MapType::mapped_type(
const ValueType &)>
168 template <
typename... ValuesOrMaps>
169 void insert(
const ValuesOrMaps &... more) {
174 template <
typename Iterator>
178 for (
auto it =
begin; it !=
end; ++it) {
230 return std::make_pair(
iterator(result.first), result.second);
234 template <
typename A,
typename B,
typename C,
typename D,
typename E>
An iterator over a UniqueMap.
bool operator==(const UniqueMapIterator< T, M > &B) const
pointer operator->() const
UniqueMapIterator operator++(int)
std::result_of< TransformFunc(typename MapIteratorType::reference)>::type reference
UniqueMapIterator & operator++()
reference operator*() const
TransformFunc m_transform
MapIteratorType::difference_type difference_type
MapIteratorType base() const
bool operator!=(const UniqueMapIterator< T, M > &B) const
std::remove_reference< reference >::type value_type
UniqueMapIterator(MapIteratorType map_it)
std::bidirectional_iterator_tag iterator_category
UniqueMapIterator operator--(int)
UniqueMapIterator & operator--()
std::map wrapper to enforce a 1-1 ValueType->KeyType relationship
unique_map(KeyFuncType keyfunc, ConvertType _converter)
MapType::size_type size_type
const_iterator cbegin() const
iterator insert(iterator hint, const value_type &value)
Insert single value.
iterator erase(const_iterator pos)
value_type & operator[](const key_type &key)
std::pair< iterator, bool > _insert(const value_type &value)
Copy insert.
key_type key(const value_type &value) const
iterator find(const key_type &key)
iterator erase(const_iterator first, const_iterator last)
void insert(const ValuesOrMaps &... more)
Variadic insert accepts as const UniqueMap& or const ValueType&.
UniqueMapIterator< TransformFunction, MapIterator > iterator
const_iterator end() const
const_iterator begin() const
std::function< typename MapType::mapped_type(const ValueType &)> ConvertType
MapType::const_iterator ConstMapIterator
size_type erase(const key_type &key)
MapType::iterator MapIterator
std::pair< iterator, bool > insert(const value_type &value)
Insert single value.
std::function< KeyType(const ValueType &)> KeyFuncType
iterator insert(const_iterator hint, const value_type &value)
Insert single value.
UniqueMapIterator< ConstTransformFunction, ConstMapIterator > const_iterator
void insert(Iterator begin, Iterator end, typename CASM::CASM_TMP::enable_if_iterator< Iterator >::type *=nullptr)
Iterator range insert.
const_iterator cend() const
int _insert(const unique_map< A, B, C, D, E > &value)
Dictionary insert.
const_iterator find(const key_type &key) const
std::enable_if< is_iterator< T >::type::value, void > enable_if_iterator
Template alias to enable a template function via SFINAE for any iterator.
void ignore_returnvalues(Args &&...)
Enables calling a function on each argument in a parameter pack.
Non-std smart pointer classes and functions.
result_type operator()(reference pair) const
const MapType::const_iterator::value_type::second_type & result_type
MapType::const_iterator::reference reference
result_type operator()(reference pair) const
MapType::iterator::value_type::second_type & result_type
MapType::iterator::reference reference