Skip to content

Commit

Permalink
std::equal is not necessarily constexpr in C++17, so PR #474 broke ad…
Browse files Browse the repository at this point in the history
…a technically.
  • Loading branch information
lemire committed Sep 19, 2023
1 parent f4dc343 commit 4f38277
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/ada/checkers-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ inline constexpr bool is_normalized_windows_drive_letter(
return input.size() >= 2 && (is_alpha(input[0]) && (input[1] == ':'));
}

ada_really_inline constexpr bool begins_with(std::string_view view,
ada_really_inline bool begins_with(std::string_view view,
std::string_view prefix) {
// in C++20, you have view.begins_with(prefix)
// std::equal is constexpr in C++20
return view.size() >= prefix.size() &&
std::equal(prefix.begin(), prefix.end(), view.begin());
}
Expand Down
4 changes: 2 additions & 2 deletions include/ada/checkers.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ inline constexpr bool is_normalized_windows_drive_letter(
std::string_view input) noexcept;

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

/**
Expand Down

0 comments on commit 4f38277

Please sign in to comment.