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(
73 T & map [[clang::lifetimebound]],
74 const typename T::key_type & key,
75 const typename T::mapped_type & defaultValue [[clang::lifetimebound]]
78 auto i = map.find(key);
94 if (i == c.end())
return {};
95 auto v = std::move(*i);
105std::optional<typename T::value_type>
pop(T & c)
107 if (c.empty())
return {};
108 auto v = std::move(c.front());
123 MaintainCount(T & counter,
long delta = 1) : counter(counter), delta(delta) { counter += delta; }
124 ~MaintainCount() { counter -= delta; }
137 typename TIter =
decltype(std::begin(std::declval<T>())),
138 typename =
decltype(std::end(std::declval<T>()))>
145 constexpr bool operator != (
const iterator & other)
const {
return iter != other.iter; }
146 constexpr void operator ++ () { ++i; ++iter; }
147 constexpr auto operator * () {
return std::tie(i, *iter); }
150 struct iterable_wrapper
153 constexpr auto begin() {
return iterator{ 0, std::begin(iterable) }; }
154 constexpr auto end() {
return iterator{ 0, std::end(iterable) }; }
157 return iterable_wrapper{ std::forward<T>(iterable) };
164template<
class... Ts>
struct overloaded : Ts... {
using Ts::operator()...; };
std::optional< typename T::value_type > remove_begin(T &c)
Definition types.hh:91
std::optional< typename T::value_type > pop(T &c)
Definition types.hh:105
constexpr auto enumerate(T &&iterable)
Definition types.hh:139
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:181