From 245ab01230a95deeafcf64cf7c5eef5c7b0f26a7 Mon Sep 17 00:00:00 2001 From: Jason Roelofs Date: Sun, 25 Aug 2024 13:44:15 -0400 Subject: [PATCH] Re-generate rice.hpp to pick up the string_view override for Symbol --- include/rice/rice.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/rice/rice.hpp b/include/rice/rice.hpp index 1e6ccc2e..ddf79045 100644 --- a/include/rice/rice.hpp +++ b/include/rice/rice.hpp @@ -6242,6 +6242,9 @@ namespace Rice //! Construct a Symbol from an std::string. Symbol(std::string const& s); + //! Construct a Symbol from an std::string_view. + Symbol(std::string_view const& s); + //! Return a string representation of the Symbol. char const* c_str() const; @@ -6273,7 +6276,12 @@ namespace Rice } inline Symbol::Symbol(std::string const& s) - : Object(detail::protect(rb_id2sym, detail::protect(rb_intern2, s.c_str(), s.size()))) + : Object(detail::protect(rb_id2sym, detail::protect(rb_intern2, s.c_str(), (long)s.length()))) + { + } + + inline Symbol::Symbol(std::string_view const& view) + : Object(detail::protect(rb_id2sym, detail::protect(rb_intern2, view.data(), (long)view.length()))) { }