From 6b1d7a91e63b9e6f5066a20b9c45cec450baed49 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 23 Feb 2025 15:57:19 +0200 Subject: [PATCH] Use BOOST_ASSERT instead of BOOST_CORE_DETAIL_ASSERT --- include/boost/core/detail/assert.hpp | 18 ------------------ include/boost/core/span.hpp | 14 +++++++------- 2 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 include/boost/core/detail/assert.hpp diff --git a/include/boost/core/detail/assert.hpp b/include/boost/core/detail/assert.hpp deleted file mode 100644 index d677e2e..0000000 --- a/include/boost/core/detail/assert.hpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2025 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#undef BOOST_CORE_DETAIL_ASSERT - -#if !defined(__clang__) && \ - !defined(__INTEL_COMPILER) && \ - defined(__GNUC__) && \ - (__GNUC__ < 5) -#define BOOST_CORE_DETAIL_ASSERT(expr) void(0) -#else -#include -#define BOOST_CORE_DETAIL_ASSERT(expr) BOOST_ASSERT(expr) -#endif diff --git a/include/boost/core/span.hpp b/include/boost/core/span.hpp index 3a602c2..d15e762 100644 --- a/include/boost/core/span.hpp +++ b/include/boost/core/span.hpp @@ -8,8 +8,8 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_CORE_SPAN_HPP #define BOOST_CORE_SPAN_HPP -#include #include +#include #include #include #include @@ -275,18 +275,18 @@ public: } constexpr span first(size_type c) const { - return BOOST_CORE_DETAIL_ASSERT(c <= size()), + return BOOST_ASSERT(c <= size()), span(s_.p, c); } constexpr span last(size_type c) const { - return BOOST_CORE_DETAIL_ASSERT(c <= size()), + return BOOST_ASSERT(c <= size()), span(s_.p + (s_.n - c), c); } constexpr span subspan(size_type o, size_type c = dynamic_extent) const { - return BOOST_CORE_DETAIL_ASSERT(o <= size() && + return BOOST_ASSERT(o <= size() && (c == dynamic_extent || c + o <= size())), span(s_.p + o, c == dynamic_extent ? s_.n - o : c); @@ -305,15 +305,15 @@ public: } constexpr reference operator[](size_type i) const { - return BOOST_CORE_DETAIL_ASSERT(i < size()), s_.p[i]; + return BOOST_ASSERT(i < size()), s_.p[i]; } constexpr reference front() const { - return BOOST_CORE_DETAIL_ASSERT(!empty()), *s_.p; + return BOOST_ASSERT(!empty()), *s_.p; } constexpr reference back() const { - return BOOST_CORE_DETAIL_ASSERT(!empty()), s_.p[s_.n - 1]; + return BOOST_ASSERT(!empty()), s_.p[s_.n - 1]; } constexpr pointer data() const noexcept {