File tree Expand file tree Collapse file tree 4 files changed +15
-0
lines changed
Expand file tree Collapse file tree 4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ namespace Rcpp {
6666 return make_charsexp__impl__cstring (st.c_str ());
6767 }
6868
69+ #if __cplusplus >= 201703L
70+ inline SEXP make_charsexp__impl__cstring (std::string_view st) {
71+ return Rf_mkCharLen (st.data (), st.size ());
72+ }
73+ #endif
74+
6975 template <typename T>
7076 inline SEXP make_charsexp__impl (const T& s, Rcpp::traits::true_type) {
7177 return make_charsexp__impl__wstring (s);
Original file line number Diff line number Diff line change @@ -141,6 +141,9 @@ template<> struct r_type_traits<Rcomplex>{ typedef r_type_primitive_tag r_catego
141141template <> struct r_type_traits <bool >{ typedef r_type_primitive_tag r_category ; } ;
142142template <> struct r_type_traits <std::string>{ typedef r_type_string_tag r_category ; } ;
143143template <> struct r_type_traits <std::wstring>{ typedef r_type_string_tag r_category ; } ;
144+ #if __cplusplus >= 201703L
145+ template <> struct r_type_traits <std::string_view>{ typedef r_type_string_tag r_category ; } ;
146+ #endif
144147template <> struct r_type_traits <char >{ typedef r_type_string_tag r_category ; } ;
145148template <> struct r_type_traits <wchar_t >{ typedef r_type_string_tag r_category ; } ;
146149
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ template <> struct wrap_type_traits<unsigned int> { typedef wrap_type_primitive_
8282template <> struct wrap_type_traits <bool > { typedef wrap_type_primitive_tag wrap_category; } ;
8383template <> struct wrap_type_traits <std::string> { typedef wrap_type_primitive_tag wrap_category; } ;
8484template <> struct wrap_type_traits <std::wstring> { typedef wrap_type_primitive_tag wrap_category; } ;
85+ #if __cplusplus >= 201703L
86+ template <> struct wrap_type_traits <std::string_view> { typedef wrap_type_primitive_tag wrap_category; } ;
87+ #endif
8588template <> struct wrap_type_traits <Rcpp::String> { typedef wrap_type_primitive_tag wrap_category; } ;
8689template <> struct wrap_type_traits <char > { typedef wrap_type_primitive_tag wrap_category; } ;
8790template <> struct wrap_type_traits <wchar_t > { typedef wrap_type_primitive_tag wrap_category; } ;
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ namespace Rcpp {
5454#include < iomanip>
5555#include < sstream>
5656#include < string>
57+ #if __cplusplus >= 201703L
58+ #include < string_view>
59+ #endif
5760#include < list>
5861#include < map>
5962#include < set>
You can’t perform that action at this time.
0 commit comments