string_view.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. /************************************************************************************
  2. * *
  3. * Copyright (c) 2014 - 2018 Axel Menzel <info@rttr.org> *
  4. * *
  5. * This file is part of RTTR (Run Time Type Reflection) *
  6. * License: MIT License *
  7. * *
  8. * Permission is hereby granted, free of charge, to any person obtaining *
  9. * a copy of this software and associated documentation files (the "Software"), *
  10. * to deal in the Software without restriction, including without limitation *
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  12. * and/or sell copies of the Software, and to permit persons to whom the *
  13. * Software is furnished to do so, subject to the following conditions: *
  14. * *
  15. * The above copyright notice and this permission notice shall be included in *
  16. * all copies or substantial portions of the Software. *
  17. * *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
  24. * SOFTWARE. *
  25. * *
  26. *************************************************************************************/
  27. #ifndef RTTR_STRING_VIEW_H_
  28. #define RTTR_STRING_VIEW_H_
  29. #include "rttr/detail/base/core_prerequisites.h"
  30. #include <string>
  31. #include <ostream>
  32. namespace rttr
  33. {
  34. /*!
  35. * The class template \ref basic_string_view describes an non-owning reference to a
  36. * constant contiguous sequence of char-like objects.
  37. *
  38. * The purpose of this class is to avoid copying of data which is already owned somewhere else.
  39. * Creating a basic_string_view will never do any heap allocation.
  40. */
  41. template<typename CharT, typename Traits = std::char_traits<CharT> >
  42. class basic_string_view
  43. {
  44. public:
  45. using traits_type = Traits;
  46. using value_type = CharT;
  47. using pointer = CharT*;
  48. using const_pointer = const CharT*;
  49. using reference = CharT&;
  50. using const_reference = const CharT&;
  51. using const_iterator = const_pointer;
  52. using iterator = const_iterator;
  53. using const_reverse_iterator = std::reverse_iterator<const_iterator>;
  54. using reverse_iterator = const_reverse_iterator;
  55. using size_type = std::size_t;
  56. using difference_type = std::ptrdiff_t;
  57. RTTR_STATIC_CONSTEXPR size_type npos = size_type(-1);
  58. /*!
  59. * \brief Default constructor. Constructs an empty basic_string_view.
  60. */
  61. RTTR_CONSTEXPR basic_string_view() RTTR_NOEXCEPT;
  62. /*!
  63. * \brief Copy constructor. Constructs a view of the same content as \p other.
  64. */
  65. RTTR_CONSTEXPR basic_string_view(const basic_string_view& other) RTTR_NOEXCEPT;
  66. /*!
  67. * \brief Constructs a view of the null-terminated character string pointed to by \p str, not including the terminating null character.
  68. * The length of the view is determined as if by `Traits::length(str)`.
  69. * The behavior is undefined if `[str, str + Traits::length(str))` is not a valid range
  70. * (even though the constructor may not access any of the elements of this range).
  71. */
  72. RTTR_CONSTEXPR basic_string_view(const CharT* str);
  73. /*!
  74. * \brief Constructs a view of the first count characters of the character array starting with the element pointed by \p str.
  75. * \p str can contain null characters.
  76. * The behavior is undefined if `[str, str + count)` is not a valid range
  77. * (even though the constructor may not access any of the elements of this range).
  78. */
  79. RTTR_CONSTEXPR basic_string_view(const CharT* str, size_type len);
  80. /*!
  81. * \brief Constructs a view of the first \p str.size() characters of the character array
  82. * starting with the element pointed by \p str.data().
  83. */
  84. template<typename Allocator>
  85. basic_string_view(const std::basic_string<CharT, Traits, Allocator>& str) RTTR_NOEXCEPT;
  86. /*!
  87. * \brief Replaces the this view with that of \p other view.
  88. */
  89. basic_string_view& operator=(const basic_string_view& other) RTTR_NOEXCEPT;
  90. RTTR_CXX14_CONSTEXPR void swap(basic_string_view& s) RTTR_NOEXCEPT;
  91. /*!
  92. * \brief Returns an iterator to the beginning of the view.
  93. *
  94. * \return const_iterator to the first character of this view.
  95. */
  96. RTTR_CONSTEXPR const_iterator begin() const RTTR_NOEXCEPT;
  97. /*!
  98. * \brief Returns an iterator to the beginning of the view.
  99. *
  100. * \return const_iterator to the first character of this view.
  101. */
  102. RTTR_CONSTEXPR const_iterator cbegin() const RTTR_NOEXCEPT;
  103. /*!
  104. * \brief Returns an iterator to the character following the last character of the view.
  105. * Do **not** access this character, it will result in undefined behavior.
  106. *
  107. * \return const_iterator to the character following the last character.
  108. */
  109. RTTR_CONSTEXPR const_iterator end() const RTTR_NOEXCEPT;
  110. /*!
  111. * \brief Returns an iterator to the character following the last character of the view.
  112. * Do **not** access this character, it will result in undefined behavior.
  113. *
  114. * \return const_iterator to the character following the last character.
  115. */
  116. RTTR_CONSTEXPR const_iterator cend() const RTTR_NOEXCEPT;
  117. /*!
  118. * \brief Returns a reverse iterator to the first character of the reversed view.
  119. * It corresponds to the last character of the non-reversed view.
  120. *
  121. * \return const_reverse_iterator to the first character.
  122. */
  123. const_reverse_iterator rbegin() const RTTR_NOEXCEPT;
  124. /*!
  125. * \brief Returns a reverse iterator to the first character of the reversed view.
  126. * It corresponds to the last character of the non-reversed view.
  127. *
  128. * \return const_reverse_iterator to the first character.
  129. */
  130. const_reverse_iterator crbegin() const RTTR_NOEXCEPT;
  131. /*!
  132. * \brief Returns a reverse iterator to the character following the last character of the reversed view.
  133. * It corresponds to the character preceding the first character of the non-reversed view.
  134. * Do **not** access this character, it will result in undefined behavior.
  135. *
  136. * \return const_reverse_iterator to the character following the last character.
  137. */
  138. const_reverse_iterator rend() const RTTR_NOEXCEPT;
  139. /*!
  140. * \brief Returns a reverse iterator to the character following the last character of the reversed view.
  141. * It corresponds to the character preceding the first character of the non-reversed view.
  142. * Do **not** access this character, it will result in undefined behavior.
  143. *
  144. * \return const_reverse_iterator to the character following the last character.
  145. */
  146. const_reverse_iterator crend() const RTTR_NOEXCEPT;
  147. /*!
  148. * \brief Returns the number of `CharT` elements in the view, i.e. `std::distance(begin(), end())`.
  149. *
  150. * \return The number of `CharT` elements in the view.
  151. */
  152. RTTR_CONSTEXPR size_type size() const RTTR_NOEXCEPT;
  153. /*!
  154. * \brief Returns the number of `CharT` elements in the view, i.e. `std::distance(begin(), end())`.
  155. *
  156. * \return The number of `CharT` elements in the view.
  157. */
  158. RTTR_CONSTEXPR size_type length() const RTTR_NOEXCEPT;
  159. /*!
  160. * \brief The largest possible number of char-like objects that can be referred to by a \ref basic_string_view.
  161. *
  162. * \return Maximum number of characters.
  163. */
  164. RTTR_CONSTEXPR size_type max_size() const RTTR_NOEXCEPT;
  165. /*!
  166. * \brief Checks if the view has no characters, i.e. whether size() == 0.
  167. *
  168. * \return `true` if the view is empty, `false` otherwise.
  169. */
  170. RTTR_CONSTEXPR bool empty() const RTTR_NOEXCEPT;
  171. /*!
  172. * \brief Returns a const reference to the character at specified location \p pos.
  173. * No bounds checking is performed: the behavior is undefined if `pos >= size()`.
  174. *
  175. * \return Const reference to the requested character.
  176. */
  177. RTTR_CONSTEXPR const_reference operator[](size_type pos) const RTTR_NOEXCEPT;
  178. /*!
  179. * \brief Returns reference to the first character in the view.
  180. *
  181. * \return Reference to the first character, equivalent to `operator[](0)`.
  182. */
  183. RTTR_CONSTEXPR const_reference front() const;
  184. /*!
  185. * \brief Returns reference to the last character in the view.
  186. *
  187. * \return Reference to the last character, equivalent to `operator[](size() - 1)`.
  188. */
  189. RTTR_CONSTEXPR const_reference back() const;
  190. /*!
  191. * \brief Returns a pointer to the underlying character array.
  192. * The pointer is such that the range `[data(); data() + size())` is valid and the values in it correspond to the values of the view.
  193. *
  194. * \remark Passing \ref data() to a function which takes a `const CharT*` may not work,
  195. * because the underlying buffer may **not** contain a null-terminated character.
  196. *
  197. * \return A pointer to the underlying character array.
  198. */
  199. RTTR_CONSTEXPR const_pointer data() const RTTR_NOEXCEPT;
  200. /*!
  201. * \brief Moves the start of the view forward by n characters.
  202. * The behavior is undefined if `n > size()`.
  203. */
  204. RTTR_CXX14_CONSTEXPR void remove_prefix(size_type n) RTTR_NOEXCEPT;
  205. /*!
  206. * \brief Moves the end of the view back by n characters.
  207. * The behavior is undefined if `n > size()`.
  208. */
  209. RTTR_CXX14_CONSTEXPR void remove_suffix(size_type n) RTTR_NOEXCEPT;
  210. /*!
  211. * \brief Creates a `basic_string` with a copy of the content of the current view.
  212. *
  213. * \return A basic_string containing a copy of the characters of the current view.
  214. */
  215. template<typename Allocator>
  216. explicit operator std::basic_string<CharT, Traits, Allocator>() const;
  217. /*!
  218. * \brief Creates a `basic_string` with a copy of the content of the current view.
  219. *
  220. * \return A `basic_string` containing a copy of the characters of the current view.
  221. */
  222. template<typename Allocator = std::allocator<CharT> >
  223. std::basic_string<CharT, Traits> to_string(const Allocator& a = Allocator()) const;
  224. /*!
  225. * \brief The function compares the two views by calling `Traits::compare(data(), v.data(), length)`,
  226. * where \p length is the small of `size()` and `v.size()`.
  227. *
  228. * \return negative value if this view is less than the other character sequence,
  229. * zero if the both character sequences are equal,
  230. * positive value if this view is greater than the other character sequence.
  231. */
  232. RTTR_CXX14_CONSTEXPR int compare(basic_string_view v) const RTTR_NOEXCEPT;
  233. /*!
  234. * \brief Equivalent to `compare(basic_string_view(c))`.
  235. *
  236. * \return negative value if this view is less than the other character sequence,
  237. * zero if the both character sequences are equal,
  238. * positive value if this view is greater than the other character sequence.
  239. */
  240. RTTR_CXX14_CONSTEXPR int compare(const CharT* c) const RTTR_NOEXCEPT;
  241. private:
  242. const value_type* m_data;
  243. size_type m_size;
  244. };
  245. /////////////////////////////////////////////////////////////////////////////////////////
  246. /////////////////////////////////////////////////////////////////////////////////////////
  247. /////////////////////////////////////////////////////////////////////////////////////////
  248. // friend functions
  249. // MSVC 2013 cannot handle type deduction correctly, thats why we have to declare and
  250. // define all possibility compares explicitly
  251. /*!
  252. * \brief Compares the two views \p lhs and \p rhs.
  253. * Two views are equal if both the \ref size() of \p lhs and \p rhs are equal
  254. * and each character in \p lhs has an equivalent character in \p rhs at the same position.
  255. *
  256. * \return `true` when both views are the same, otherwise `false`.
  257. */
  258. template<typename CharT, typename Traits>
  259. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator==(basic_string_view<CharT, Traits> lhs,
  260. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  261. template<typename CharT, typename Traits>
  262. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator==(const char* lhs,
  263. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  264. template<typename CharT, typename Traits>
  265. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator==(basic_string_view<CharT, Traits> lhs,
  266. const char* rhs) RTTR_NOEXCEPT;
  267. template<typename CharT, typename Traits>
  268. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator==(const std::basic_string<CharT, Traits>& lhs,
  269. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  270. template<typename CharT, typename Traits>
  271. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator==(basic_string_view<CharT, Traits> lhs,
  272. const std::basic_string<CharT, Traits>& rhs) RTTR_NOEXCEPT;
  273. /////////////////////////////////////////////////////////////////////////////////////////
  274. /*!
  275. * \brief Compares the two views \p lhs and \p rhs.
  276. * Two views are not equal if the \ref size() differ or
  277. * the characters of \p lhs are not equivalent and in the same position in \p rhs.
  278. *
  279. * \return `true` when both views are **not** the same, otherwise `false`.
  280. */
  281. template<typename CharT, typename Traits>
  282. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator!=(basic_string_view<CharT, Traits> lhs,
  283. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  284. template<typename CharT, typename Traits>
  285. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator!=(const char* lhs,
  286. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  287. template<typename CharT, typename Traits>
  288. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator!=(basic_string_view<CharT, Traits> lhs,
  289. const char* rhs) RTTR_NOEXCEPT;
  290. template<typename CharT, typename Traits>
  291. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator!=(const std::basic_string<CharT, Traits>& lhs,
  292. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  293. template<typename CharT, typename Traits>
  294. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator!=(basic_string_view<CharT, Traits> lhs,
  295. const std::basic_string<CharT, Traits>& rhs) RTTR_NOEXCEPT;
  296. /////////////////////////////////////////////////////////////////////////////////////////
  297. /*!
  298. * \brief Compares the two views \p lhs and \p rhs.
  299. * The ordering comparisons is done lexicographically.
  300. * The comparison is performed by a function equivalent to `std::lexicographical_compare`.
  301. *
  302. * \return `true` when lhs is smaller or equal to \p rhs, otherwise false.
  303. */
  304. template<typename CharT, typename Traits>
  305. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<=(basic_string_view<CharT, Traits> lhs,
  306. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  307. template<typename CharT, typename Traits>
  308. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<=(const char* lhs,
  309. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  310. template<typename CharT, typename Traits>
  311. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<=(basic_string_view<CharT, Traits> lhs,
  312. const char* rhs) RTTR_NOEXCEPT;
  313. template<typename CharT, typename Traits>
  314. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<=(const std::basic_string<CharT, Traits>& lhs,
  315. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  316. template<typename CharT, typename Traits>
  317. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<=(basic_string_view<CharT, Traits> lhs,
  318. const std::basic_string<CharT, Traits>& rhs) RTTR_NOEXCEPT;
  319. /////////////////////////////////////////////////////////////////////////////////////////
  320. /*!
  321. * \brief Compares the two views \p lhs and \p rhs.
  322. * The ordering comparisons is done lexicographically.
  323. * The comparison is performed by a function equivalent to `std::lexicographical_compare`.
  324. *
  325. * \return `true` when lhs is greater or equal to \p rhs, otherwise false.
  326. */
  327. template<typename CharT, typename Traits>
  328. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>=(basic_string_view<CharT, Traits> lhs,
  329. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  330. template<typename CharT, typename Traits>
  331. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>=(const char* lhs,
  332. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  333. template<typename CharT, typename Traits>
  334. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>=(basic_string_view<CharT, Traits> lhs,
  335. const char* rhs) RTTR_NOEXCEPT;
  336. template<typename CharT, typename Traits>
  337. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>=(const std::basic_string<CharT, Traits>& lhs,
  338. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  339. template<typename CharT, typename Traits>
  340. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>=(basic_string_view<CharT, Traits> lhs,
  341. const std::basic_string<CharT, Traits>& rhs) RTTR_NOEXCEPT;
  342. /////////////////////////////////////////////////////////////////////////////////////////
  343. /*!
  344. * \brief Compares the two views \p lhs and \p rhs.
  345. * The ordering comparisons is done lexicographically.
  346. * The comparison is performed by a function equivalent to `std::lexicographical_compare`.
  347. *
  348. * \return `true` when lhs is greater than \p rhs, otherwise false.
  349. */
  350. template<typename CharT, typename Traits>
  351. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>(basic_string_view<CharT, Traits> lhs,
  352. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  353. template<typename CharT, typename Traits>
  354. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>(const char* lhs,
  355. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  356. template<typename CharT, typename Traits>
  357. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>(basic_string_view<CharT, Traits> lhs,
  358. const char* rhs) RTTR_NOEXCEPT;
  359. template<typename CharT, typename Traits>
  360. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>(const std::basic_string<CharT, Traits>& lhs,
  361. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  362. template<typename CharT, typename Traits>
  363. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator>(basic_string_view<CharT, Traits> lhs,
  364. const std::basic_string<CharT, Traits>& rhs) RTTR_NOEXCEPT;
  365. /////////////////////////////////////////////////////////////////////////////////////////
  366. /*!
  367. * \brief Compares the two views \p lhs and \p rhs.
  368. * The ordering comparisons is done lexicographically.
  369. * The comparison is performed by a function equivalent to `std::lexicographical_compare`.
  370. *
  371. * \return `true` when lhs is smaller than \p rhs, otherwise false.
  372. */
  373. template<typename CharT, typename Traits>
  374. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<(basic_string_view<CharT, Traits> lhs,
  375. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  376. template<typename CharT, typename Traits>
  377. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<(const char* lhs,
  378. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  379. template<typename CharT, typename Traits>
  380. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<(basic_string_view<CharT, Traits> lhs,
  381. const char* rhs) RTTR_NOEXCEPT;
  382. template<typename CharT, typename Traits>
  383. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<(const std::basic_string<CharT, Traits>& lhs,
  384. basic_string_view<CharT, Traits> rhs) RTTR_NOEXCEPT;
  385. template<typename CharT, typename Traits>
  386. RTTR_INLINE RTTR_CXX14_CONSTEXPR bool operator<(basic_string_view<CharT, Traits> lhs,
  387. const std::basic_string<CharT, Traits>& rhs) RTTR_NOEXCEPT;
  388. /////////////////////////////////////////////////////////////////////////////////////////
  389. template<typename CharT, typename Traits>
  390. RTTR_INLINE std::basic_string<CharT, Traits> operator+(basic_string_view<CharT, Traits> lhs,
  391. const std::basic_string<CharT, Traits>& rhs);
  392. template<typename CharT, typename Traits>
  393. RTTR_INLINE std::basic_string<CharT, Traits> operator+(const std::basic_string<CharT, Traits>& lhs,
  394. basic_string_view<CharT, Traits> rhs);
  395. template<typename CharT, typename Traits>
  396. RTTR_INLINE std::basic_string<CharT, Traits> operator+(basic_string_view<CharT, Traits> lhs,
  397. std::basic_string<CharT, Traits>&& rhs);
  398. template<typename CharT, typename Traits>
  399. RTTR_INLINE std::basic_string<CharT, Traits> operator+(std::basic_string<CharT, Traits>&& lhs,
  400. basic_string_view<CharT, Traits> rhs);
  401. /////////////////////////////////////////////////////////////////////////////////////////
  402. /*!
  403. * \brief Performs a stream output on a basic_string_view .
  404. *
  405. * \return os
  406. */
  407. template <typename CharT, typename Traits>
  408. std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
  409. basic_string_view<CharT, Traits> v);
  410. /*!
  411. * A class to hold a reference to a continuous sequence of `char` objects.
  412. */
  413. using string_view = basic_string_view<char>;
  414. } // end namespace rttr
  415. #include "rttr/detail/impl/string_view_impl.h"
  416. #endif // RTTR_STRING_VIEW_H_