diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-08-20 11:18:35 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-10-13 12:12:44 +0200 |
commit | 262520fcfe2544a7278b6b5967d0d8b605fd89d9 (patch) | |
tree | 05750f4917f309c33d50b7dd6265da3879ed4501 /src/libutil/util.hh | |
parent | ff453b06f94b4305694beac8255d9ff51bed1a63 (diff) |
Use a thread per connection
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 528d113db..76f80f7a4 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -511,6 +511,18 @@ std::optional<typename T::mapped_type> get(const T & map, const typename T::key_ } +/* Remove and return the first item from a container. */ +template <class T> +std::optional<typename T::value_type> remove_begin(T & c) +{ + auto i = c.begin(); + if (i == c.end()) return {}; + auto v = std::move(*i); + c.erase(i); + return v; +} + + template<typename T> class Callback; |