From bbcd5f5973efd078dbb6b0d324b65c2d7ed29695 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 5 Jul 2020 23:34:32 +0000 Subject: [PATCH] Use C++17 std::size instead of a custom equivalent The custom version was used before C++17 was enabled. Now that C++17 std::size is available, switch to it. --- common/include/partial_range.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/common/include/partial_range.h b/common/include/partial_range.h index f53febece..54ff4fb57 100644 --- a/common/include/partial_range.h +++ b/common/include/partial_range.h @@ -212,23 +212,10 @@ inline void check_range_bounds(const char *file, unsigned line, const char *estr #undef PARTIAL_RANGE_COMPILE_CHECK_BOUND } -/* C arrays lack a size method, but have a constant size */ -template -constexpr std::integral_constant get_range_size(T (&)[d]) -{ - return {}; -} - -template -constexpr std::size_t get_range_size(T &t) -{ - return t.size(); -} - template inline void check_partial_range(const char *file, unsigned line, const char *estr, const T &t, const std::size_t o, const std::size_t l) { - check_range_bounds(file, line, estr, std::addressof(t), o, l, get_range_size(t)); + check_range_bounds(file, line, estr, std::addressof(t), o, l, std::size(t)); } #ifdef DXX_HAVE_BUILTIN_OBJECT_SIZE