mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-06-15 08:26:16 +08:00
Adds substr, find/rfind/find_first_of/find_last_of/find_first_not_of/ find_last_not_of, starts_with/ends_with, and operator[] to string_view_type, mirroring string_type's search/substring surface so script authors can traverse a buffer through string_view without allocating. Sharing method names with string_type creates an ambiguity in dispatch_with_conversions when the script call needs arithmetic conversion (e.g. myString.substr(int, int)): both string::substr and string_view::substr match-except-for-arithmetic, and the existing const/non-const tiebreaker doesn't apply. Extend dispatch_with_conversions to prefer the candidate whose first/receiver parameter type exactly matches the actual receiver, mirroring the deprioritization already in dispatch(). With this in place, myString.substr(1, 2) still resolves to string::substr while mySV.substr(1, 2) resolves to string_view::substr (returning a string_view). Updates the doc comment on string_view_type and adds a compiled test that locks in both dispatch directions plus the new search/substring methods. Requested by @lefticus in PR #697 review. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| any.hpp | ||
| bad_boxed_cast.hpp | ||
| bind_first.hpp | ||
| bootstrap_stl.hpp | ||
| bootstrap.hpp | ||
| boxed_cast_helper.hpp | ||
| boxed_cast.hpp | ||
| boxed_number.hpp | ||
| boxed_value.hpp | ||
| callable_traits.hpp | ||
| dispatchkit.hpp | ||
| dynamic_object_detail.hpp | ||
| dynamic_object.hpp | ||
| exception_specification.hpp | ||
| function_call_detail.hpp | ||
| function_call.hpp | ||
| function_params.hpp | ||
| function_signature.hpp | ||
| handle_return.hpp | ||
| operators.hpp | ||
| proxy_constructors.hpp | ||
| proxy_functions_detail.hpp | ||
| proxy_functions.hpp | ||
| register_function.hpp | ||
| type_conversions.hpp | ||
| type_info.hpp | ||