Skip to content

Commit 661717e

Browse files
authored
std::equal is not necessarily constexpr in C++17 (#512)
* std::equal is not necessarily constexpr in C++17, so PR #474 broke ada technically. * clang-format
1 parent f4dc343 commit 661717e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

include/ada/checkers-inl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ inline constexpr bool is_normalized_windows_drive_letter(
5454
return input.size() >= 2 && (is_alpha(input[0]) && (input[1] == ':'));
5555
}
5656

57-
ada_really_inline constexpr bool begins_with(std::string_view view,
58-
std::string_view prefix) {
57+
ada_really_inline bool begins_with(std::string_view view,
58+
std::string_view prefix) {
5959
// in C++20, you have view.begins_with(prefix)
60+
// std::equal is constexpr in C++20
6061
return view.size() >= prefix.size() &&
6162
std::equal(prefix.begin(), prefix.end(), view.begin());
6263
}

include/ada/checkers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ inline constexpr bool is_normalized_windows_drive_letter(
7070
std::string_view input) noexcept;
7171

7272
/**
73-
* @warning Will be removed when Ada supports C++20.
73+
* @warning Will be removed when Ada requires C++20.
7474
*/
75-
ada_really_inline constexpr bool begins_with(std::string_view view,
76-
std::string_view prefix);
75+
ada_really_inline bool begins_with(std::string_view view,
76+
std::string_view prefix);
7777

7878
/**
7979
* Returns true if an input is an ipv4 address.

0 commit comments

Comments
 (0)