From fbde6e7792fc8916aa498c3525e730f823c8d9a6 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sat, 2 May 2026 19:31:36 -0400 Subject: [PATCH] Use ssize if available --- include/chaiscript/language/chaiscript_parser.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index 406d6eb9..dad2f6f5 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -2941,7 +2941,11 @@ namespace chaiscript { /// Parses the given input string, tagging parsed ast_nodes with the given m_filename. AST_NodePtr parse_internal(const std::string &t_input, std::string t_fname) { const auto begin = t_input.empty() ? nullptr : &t_input.front(); - const auto end = begin == nullptr ? nullptr : std::next(begin, (int)std::size(t_input)); // std::ssize() isn't available in C++17 + #if __cplusplus >= 202002L + const auto end = begin == nullptr ? nullptr : std::next(begin, std::ssize(t_input)); + #else + const auto end = begin == nullptr ? nullptr : std::next(begin, (int)std::size(t_input)); + #endif m_position = Position(begin, end); m_filename = std::make_shared(std::move(t_fname));