15 #include "RConfigure.h"
17 #ifdef R__HAS_STD_STRING_VIEW
19 #include <string_view>
23 # if defined(R__HAS_STD_EXPERIMENTAL_STRING_VIEW)
24 # include <experimental/string_view>
31 template<
class _CharT,
class _Traits = std::
char_traits<_CharT> >
32 using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
35 typedef basic_string_view<char> string_view;
36 typedef basic_string_view<char16_t> u16string_view;
37 typedef basic_string_view<char32_t> u32string_view;
38 typedef basic_string_view<wchar_t> wstring_view;
47 #ifndef R__HAS_STOD_STRING_VIEW
48 inline double stod(std::string_view str,
size_t *pos)
50 return std::stod(std::string(str.data(), str.size()),pos);
56 #endif // ifdef else R__HAS_STD_STRING_VIEW
58 #ifndef R__HAS_OP_EQUAL_PLUS_STRING_VIEW
63 inline namespace __ROOT {
65 inline std::string &operator+=(std::string &left, std::string_view right)
67 return left.append(right.data(), right.size());
73 #endif // ifndef R__HAS_OP_EQUAL_PLUS_STRING_VIEW
78 const char *fData{
nullptr};
82 explicit TStringView(
const char *cstr,
size_t len) : fData(cstr), fLength(len) {}
84 operator std::string_view()
const {
return std::string_view(fData,fLength); }
88 #endif // RStringView_H