Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile with c++20 support #920

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ endif()

set(DEFAULT_TARGET_PROPS
# Require C++17.
CXX_STANDARD 17
CXX_STANDARD 20
halx99 marked this conversation as resolved.
Show resolved Hide resolved
CXX_STANDARD_REQUIRED TRUE
# Prefer C11, but support C99 and earlier when possible.
C_STANDARD 11)
Expand Down
4 changes: 3 additions & 1 deletion common/almalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ constexpr T *to_address(T *p) noexcept

template<typename T>
constexpr auto to_address(const T &p) noexcept
{ return to_address(p.operator->()); }
{
return ::al::to_address(p.operator->());
}


template<typename T, typename ...Args>
Expand Down
10 changes: 5 additions & 5 deletions common/alspan.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ class span {
template<bool is0=(extent == 0), REQUIRES(is0)>
constexpr span() noexcept { }
template<typename U>
constexpr explicit span(U iter, index_type) : mData{to_address(iter)} { }
constexpr explicit span(U iter, index_type) : mData{::al::to_address(iter)} { }
template<typename U, typename V, REQUIRES(!std::is_convertible<V,size_t>::value)>
constexpr explicit span(U first, V) : mData{to_address(first)} { }
constexpr explicit span(U first, V) : mData{::al::to_address(first)}
{}

constexpr span(type_identity_t<element_type> (&arr)[E]) noexcept
: span{std::data(arr), std::size(arr)}
Expand Down Expand Up @@ -191,11 +192,10 @@ class span<T,dynamic_extent> {

constexpr span() noexcept = default;
template<typename U>
constexpr span(U iter, index_type count)
: mData{to_address(iter)}, mDataEnd{to_address(iter)+count}
constexpr span(U iter, index_type count) : mData{::al::to_address(iter)}, mDataEnd{::al::to_address(iter) + count}
{ }
template<typename U, typename V, REQUIRES(!std::is_convertible<V,size_t>::value)>
constexpr span(U first, V last) : span{to_address(first), static_cast<size_t>(last-first)}
constexpr span(U first, V last) : span{::al::to_address(first), static_cast<size_t>(last - first)}
{ }

template<size_t N>
Expand Down
Loading