79# include <initializer_list>
87template<
typename T>
class DynList;
113# define Special_Ctors(Set_Type, Type) \
114 template <template <typename> class List> \
115 Set_Type(const List<Type> & l) : Set_Type() \
117 l.for_each([this] (const Type & item) { (void)this->append(item); }); \
120 template <class It> \
121 Set_Type(It b, It e) : Set_Type() \
123 for (It it = b; it != e; ++it) \
124 (void)this->append(*it); \
127 Set_Type(std::initializer_list<Type> l) : Set_Type() \
129 for (const auto & item : l) \
130 (void)this->append(item); \
139# define Generic_Items(Type) \
140 template <template <typename> class Container = DynList> \
141 Container<Type> items() const \
143 return this->template maps<Type, Container> ([] (const Type & key) \
151# define Generate_Proxy_Operator(Class_Name) \
152 const Data & operator [] (const Key & key) const \
157 Data & operator [] (const Key & key) \
171template<
typename Type>
inline
174 std::ostringstream
os;
188template<
typename Key,
typename Data,
class Cmp = std::equal_to<Key>>
196 const std::pair<Key, Data> &p2)
const noexcept
198 return cmp(p1.first, p2.first);
203 const Key &
k)
const noexcept
205 return cmp(p.first,
k);
210 const std::pair<Key, Data> &p)
const noexcept
212 return cmp(
k, p.first);
220template<
typename Key,
typename Data>
223 using PairType = std::pair<Key, Data>;
224 return reinterpret_cast<PairType *
>(
229template<
typename Key,
typename Data>
232 using PairType = std::pair<Key, Data>;
233 return reinterpret_cast<const PairType *
>(
241template<
typename Key,
typename Data>
244 using PairType = std::pair<Key, Data>;
245 return reinterpret_cast<PairType *
>(
250template<
typename Key,
typename Data>
253 using PairType = std::pair<Key, Data>;
254 return reinterpret_cast<const PairType *
>(
Exception handling system with formatted messages for Aleph-w.
Functional programming utilities for Aleph-w containers.
Main namespace for Aleph-w library functions.
std::pair< Key, Data > * key_to_pair(Key *ptr)
Converts a pointer to Key to a pointer to the containing pair.
std::pair< Key, Data > * data_to_pair(Data *ptr)
Converts a pointer to Data to a pointer to the containing pair.
std::string to_str(const double d)
Convert double to a std::string with maximum round-trip precision.
DynList< T > maps(const C &c, Op op)
Classic map operation.
Default comparator for pair types in hash maps.
bool operator()(const Key &k, const std::pair< Key, Data > &p) const noexcept
Heterogeneous: Key vs Pair.
Dft_Pair_Cmp(Cmp __cmp=Cmp())
bool operator()(const std::pair< Key, Data > &p, const Key &k) const noexcept
Heterogeneous: Pair vs Key.
bool operator()(const std::pair< Key, Data > &p1, const std::pair< Key, Data > &p2) const noexcept
Pair vs Pair comparison.