29 template<
typename T1,
typename T2>
30 inline constexpr
bool decayed_is_same = std::is_same_v<std::decay_t<T1>, std::decay_t<T2>>;
39 template<
typename Enum>
42 return static_cast<std::underlying_type_t<Enum>
>(
e);
51 template<
typename Container,
typename Value>
54 static bool eval(
const Container& container,
const Value& value)
56 typename Container::const_iterator end = container.end();
57 return std::find(container.begin(), end, value) != end;
66 template<
typename Container>
69 static bool eval(
const Container& container,
const typename Container::key_type& value)
71 return container.find(value) != container.end();
85 template<
typename Container,
typename Value>
86 inline bool contains(
const Container& container,
const Value& value)
105 template<
typename Container,
typename Predicate>
106 void erase_if(Container& container,
const Predicate& predicate)
108 container.erase(std::remove_if(container.begin(), container.end(), predicate), container.end());
116 template<
typename Container,
typename Value>
117 std::size_t
erase(Container& container,
const Value& value)
119 auto iter =
std::remove(container.begin(), container.end(), value);
120 auto num_removed = container.end() - iter;
121 container.erase(iter, container.end());
129 template<
typename Container,
typename Predicate>
130 void sort_if(Container& container,
const Predicate& predicate)
132 std::sort(container.begin(), container.end(), predicate);
139 template<
typename Container,
typename Value>
140 auto*
find(Container& container,
const Value& value)
142 auto res = container.find(value);
143 return (res == container.end()) ? nullptr : &*res;
void remove()
Removes a tip.
constexpr bool decayed_is_same
Equivalent to as std::is_same_v except both types are passed through std::decay first.
std::size_t erase(Container &container, const Value &value)
Convenience wrapper for using std::remove on a container.
bool contains(const Container &container, const Value &value)
Returns true iff value is found in container.
std::string get_unknown_exception_type()
Utility function for finding the type of thing caught with catch(...).
void erase_if(Container &container, const Predicate &predicate)
Convenience wrapper for using std::remove_if on a container.
constexpr bool dependent_false_v
Workaround for the fact that static_assert(false) is invalid.
void sort_if(Container &container, const Predicate &predicate)
Convenience wrapper for using std::sort on a container.
constexpr std::underlying_type_t< Enum > to_underlying(Enum e) noexcept
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
static bool eval(const Container &container, const typename Container::key_type &value)
A struct that exists to implement a generic wrapper for std::find.
static bool eval(const Container &container, const Value &value)