Skip to content

Commit

Permalink
Remove unused functions from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterTh committed Nov 25, 2024
1 parent f0ca5db commit b60446e
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ auto as(P* p) {
return static_cast<std::conditional_t<std::is_const_v<P>, const T*, T*>>(p);
}

template <typename BitMaskT>
constexpr inline uint32_t popcount(const BitMaskT bit_mask) noexcept {
static_assert(std::is_integral_v<BitMaskT> && std::is_unsigned_v<BitMaskT>, "popcount argument needs to be an unsigned integer type.");

uint32_t counter = 0;
for(auto b = bit_mask; b; b >>= 1) {
counter += b & 1;
}
return counter;
}

// Implementation from Boost.ContainerHash, licensed under the Boost Software License, Version 1.0.
inline void hash_combine(std::size_t& seed, std::size_t value) { seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2); }

Expand Down Expand Up @@ -195,12 +184,6 @@ bool contains(const Container& container, const Key& key) {
}
}

template <typename Container, typename Predicate>
void erase_if(Container& container, const Predicate& predicate) {
using std::begin, std::end;
container.erase(std::remove_if(begin(container), end(container), predicate), end(container));
}

/// Replaces all occurrences of `pattern` in `in` with `with`. If `pattern` is empty, returns the input string unchanged.
std::string replace_all(const std::string_view& input, const std::string_view& pattern, const std::string_view& replacement);

Expand Down

0 comments on commit b60446e

Please sign in to comment.