16typedef std::list<std::string> Strings;
17typedef std::set<std::string> StringSet;
18typedef std::map<std::string, std::string> StringMap;
19typedef std::map<std::string, std::string> StringPairs;
23using Bytes = std::span<const char>;
29typedef std::string_view PathView;
30typedef std::list<Path> Paths;
31typedef std::set<Path> PathSet;
33typedef std::vector<std::pair<std::string, std::string>> Headers;
53const typename T::mapped_type * get(
const T & map,
const typename T::key_type & key)
55 auto i = map.find(key);
56 if (i == map.end())
return nullptr;
61typename T::mapped_type * get(T & map,
const typename T::key_type & key)
63 auto i = map.find(key);
64 if (i == map.end())
return nullptr;
72const typename T::mapped_type &
getOr(T & map,
73 const typename T::key_type & key,
74 const typename T::mapped_type & defaultValue)
76 auto i = map.find(key);
77 if (i == map.end())
return defaultValue;
88 if (i == c.end())
return {};
89 auto v = std::move(*i);
99std::optional<typename T::value_type>
pop(T & c)
101 if (c.empty())
return {};
102 auto v = std::move(c.front());
117 MaintainCount(T & counter,
long delta = 1) : counter(counter), delta(delta) { counter += delta; }
131 typename TIter =
decltype(std::begin(std::declval<T>())),
132 typename =
decltype(std::end(std::declval<T>()))>
139 constexpr bool operator != (
const iterator & other)
const {
return iter != other.iter; }
140 constexpr void operator ++ () { ++i; ++iter; }
141 constexpr auto operator * () {
return std::tie(i, *iter); }
144 struct iterable_wrapper
147 constexpr auto begin() {
return iterator{ 0, std::begin(iterable) }; }
148 constexpr auto end() {
return iterator{ 0, std::end(iterable) }; }
151 return iterable_wrapper{ std::forward<T>(iterable) };
158template<
class... Ts>
struct overloaded : Ts... {
using Ts::operator()...; };
std::optional< typename T::value_type > remove_begin(T &c)
Definition types.hh:85
std::optional< typename T::value_type > pop(T &c)
Definition types.hh:99
constexpr auto enumerate(T &&iterable)
Definition types.hh:133
std::string Path
Definition types.hh:28
const T::mapped_type & getOr(T &map, const typename T::key_type &key, const typename T::mapped_type &defaultValue)
Definition types.hh:72
constexpr NeverAsync always_progresses
Definition types.hh:175