Skip to content

Commit

Permalink
Rename detail assert macro since it isn't a public facility
Browse files Browse the repository at this point in the history
  • Loading branch information
glenfe committed Jan 18, 2025
1 parent cb603c9 commit b9a2221
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions include/boost/core/detail/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copyright 2025 Glen Joseph Fernandes
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#undef BOOST_CORE_ASSERT
#undef BOOST_CORE_DETAIL_ASSERT

#include <cassert>

Expand All @@ -14,8 +14,8 @@ Distributed under the Boost Software License, Version 1.0.
!defined(__INTEL_COMPILER) && \
defined(__GNUC__) && \
(__GNUC__ < 5)
#define BOOST_CORE_ASSERT(expr) \
#define BOOST_CORE_DETAIL_ASSERT(expr) \
((expr) ? void(0) : __assert_fail(#expr, __FILE__, __LINE__, 0))
#else
#define BOOST_CORE_ASSERT(expr) assert(expr)
#define BOOST_CORE_DETAIL_ASSERT(expr) assert(expr)
#endif
12 changes: 6 additions & 6 deletions include/boost/core/span.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,18 @@ class span {
}

constexpr span<T, dynamic_extent> first(size_type c) const {
return BOOST_CORE_ASSERT(c <= size()),
return BOOST_CORE_DETAIL_ASSERT(c <= size()),
span<T, dynamic_extent>(s_.p, c);
}

constexpr span<T, dynamic_extent> last(size_type c) const {
return BOOST_CORE_ASSERT(c <= size()),
return BOOST_CORE_DETAIL_ASSERT(c <= size()),
span<T, dynamic_extent>(s_.p + (s_.n - c), c);
}

constexpr span<T, dynamic_extent> subspan(size_type o,
size_type c = dynamic_extent) const {
return BOOST_CORE_ASSERT(o <= size() &&
return BOOST_CORE_DETAIL_ASSERT(o <= size() &&
(c == dynamic_extent || c + o <= size())),
span<T, dynamic_extent>(s_.p + o,
c == dynamic_extent ? s_.n - o : c);
Expand All @@ -305,15 +305,15 @@ class span {
}

constexpr reference operator[](size_type i) const {
return BOOST_CORE_ASSERT(i < size()), s_.p[i];
return BOOST_CORE_DETAIL_ASSERT(i < size()), s_.p[i];
}

constexpr reference front() const {
return BOOST_CORE_ASSERT(!empty()), *s_.p;
return BOOST_CORE_DETAIL_ASSERT(!empty()), *s_.p;
}

constexpr reference back() const {
return BOOST_CORE_ASSERT(!empty()), s_.p[s_.n - 1];
return BOOST_CORE_DETAIL_ASSERT(!empty()), s_.p[s_.n - 1];
}

constexpr pointer data() const noexcept {
Expand Down

0 comments on commit b9a2221

Please sign in to comment.