10 #ifndef CONTAINER_FUNC_HPP
11 #define CONTAINER_FUNC_HPP
23 template <
typename Container>
24 inline bool include(Container &container,
typename Container::const_reference &item)
26 const bool is_member = std::find(container.begin(), container.end(), item) != container.end();
27 if (!is_member) container.emplace_back(item);
40 template <
typename Container>
41 int find_index(Container
const &container,
typename Container::const_reference item)
43 auto const it = std::find(container.begin(), container.end(), item);
44 if (it != container.end())
return std::distance(container.begin(), it);
bool include(Container &container, typename Container::const_reference &item)
Helper function to append an item to a container if it is not already contained.
int find_index(Container const &container, typename Container::const_reference item)
Helper function to get the index of an item Consider using std::set, std::unordered_set or std::flat_...