13 #include <type_traits>
26 template<
class container_t,
class value_t>
31 container.insert(container.end(), std::forward<value_t>(value));
50 template<
class container_t,
class value_t,
class predicate_t>
51 bool add_unique_if(container_t& container, value_t&& value,
const predicate_t& predicate)
53 for (
const auto& element : container)
55 if constexpr (std::is_invocable_v<predicate_t, decltype(element),
const value_t&>)
57 if (predicate(element, value))
62 if (predicate(element))
67 container.insert(container.end(), std::forward<value_t>(value));
bool add_unique(container_t &container, value_t &&value)
Add an element to the container if it doesn't already contain one.
bool add_unique_if(container_t &container, value_t &&value, const predicate_t &predicate)
Add an element to the container if all elements do not satisfy the predicate.
Check that tuple type contains T.