Skip to content

Commit

Permalink
Don't use non namespaced begin/end/size functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Nov 30, 2023
1 parent a1e7824 commit 5c5b09d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/infra/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,9 @@ template <typename Container, typename ToStringCb, typename CharT, typename Trai
std::basic_string<CharT, Traits> join(const Container& items, std::basic_string_view<CharT, Traits> joinString, ToStringCb&& cb)
{
std::ostringstream ss;
for (auto iter = begin(items); iter != end(items); ++iter) {
for (auto iter = std::begin(items); iter != std::end(items); ++iter) {
ss << cb(*iter);
if (std::next(iter) != end(items)) {
if (std::next(iter) != std::end(items)) {
ss << joinString;
}
}
Expand Down
6 changes: 3 additions & 3 deletions testutil/include/infra/test/containerasserts.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ bool container_eq(const Container1& c1, const Container2& c2)
template <typename Container1, typename Container2>
bool container_near(const Container1& c1, const Container2& c2, double epsilon)
{
REQUIRE_MESSAGE(size(c1) == size(c2), fmt::format("Container sizes do not match: {} vs {}", size(c1), size(c2)));
REQUIRE_MESSAGE(std::size(c1) == std::size(c2), fmt::format("Container sizes do not match: {} vs {}", std::size(c1), std::size(c2)));

return std::equal(begin(c1), end(c1), begin(c2), [epsilon](auto a, auto b) -> bool {
return std::equal(std::begin(c1), std::end(c1), std::begin(c2), [epsilon](auto a, auto b) -> bool {
if constexpr (std::is_floating_point_v<decltype(a)>) {
if (std::isnan(a)) { return std::isnan(b); }
if (std::isnan(b)) { return false; }
Expand All @@ -118,7 +118,7 @@ bool container_near(const Container1& c1, const Container2& c2, double epsilon)
template <typename TKey, typename TValue>
bool container_eq(const std::unordered_map<TKey, TValue>& m1, const std::unordered_map<TKey, TValue>& m2)
{
REQUIRE_MESSAGE(size(m1) == size(m2), fmt::format("Container sizes do not match: {} vs {}", size(m1), size(m2)));
REQUIRE_MESSAGE(std::size(m1) == std::size(m2), fmt::format("Container sizes do not match: {} vs {}", std::size(m1), std::size(m2)));

for (auto& [key, value] : m1) {
if (auto iter = m2.find(key); iter != m2.end()) {
Expand Down

0 comments on commit 5c5b09d

Please sign in to comment.