Skip to content

Commit d3645f7

Browse files
authored
fix build with clang-6.0.1 (Neargye#34)
1 parent 9888b08 commit d3645f7

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

include/semver.hpp

+17-14
Original file line numberDiff line numberDiff line change
@@ -527,28 +527,20 @@ using namespace semver::detail;
527527

528528
class range {
529529
public:
530-
constexpr explicit range(std::string_view str) noexcept : str_{str} {}
531-
532-
constexpr bool satisfies(const version& ver, bool include_prerelease) const {
533-
range_parser parser{str_};
534-
535-
auto is_logical_or = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::logical_or; };
536-
537-
auto is_operator = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::range_operator; };
538-
539-
auto is_number = [&parser]() constexpr noexcept -> bool { return parser.current_token.type == range_token_type::number; };
530+
constexpr explicit range(std::string_view str) noexcept : parser{str} {}
540531

532+
constexpr bool satisfies(const version& ver, bool include_prerelease) {
541533
const bool has_prerelease = ver.prerelease_type != prerelease::none;
542534

543535
do {
544-
if (is_logical_or()) {
536+
if (is_logical_or_token()) {
545537
parser.advance_token(range_token_type::logical_or);
546538
}
547539

548540
bool contains = true;
549541
bool allow_compare = include_prerelease;
550542

551-
while (is_operator() || is_number()) {
543+
while (is_operator_token() || is_number_token()) {
552544
const auto range = parser.parse_range();
553545
const bool equal_without_tags = equal_to(range.ver, ver, comparators_option::exclude_prerelease);
554546

@@ -570,7 +562,7 @@ class range {
570562
return true;
571563
}
572564

573-
} while (is_logical_or());
565+
} while (is_logical_or_token());
574566

575567
return false;
576568
}
@@ -797,7 +789,18 @@ class range {
797789
}
798790
};
799791

800-
std::string_view str_;
792+
[[nodiscard]] constexpr bool is_logical_or_token() const noexcept {
793+
return parser.current_token.type == range_token_type::logical_or;
794+
}
795+
[[nodiscard]] constexpr bool is_operator_token() const noexcept {
796+
return parser.current_token.type == range_token_type::range_operator;
797+
}
798+
799+
[[nodiscard]] constexpr bool is_number_token() const noexcept {
800+
return parser.current_token.type == range_token_type::number;
801+
}
802+
803+
range_parser parser;
801804
};
802805

803806
} // namespace semver::range::detail

0 commit comments

Comments
 (0)