string_view.hpp
Go to the documentation of this file.
1 // Copyright 2017-2018 by Martin Moene
2 //
3 // string-view lite, a C++17-like string_view for C++98 and later.
4 // For more information see https://github.com/martinmoene/string-view-lite
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #pragma once
10 
11 #ifndef NONSTD_SV_LITE_H_INCLUDED
12 #define NONSTD_SV_LITE_H_INCLUDED
13 
14 #define string_view_lite_MAJOR 1
15 #define string_view_lite_MINOR 1
16 #define string_view_lite_PATCH 0
17 
18 #define string_view_lite_VERSION \
19  nssv_STRINGIFY(string_view_lite_MAJOR) "." nssv_STRINGIFY( \
20  string_view_lite_MINOR) "." nssv_STRINGIFY(string_view_lite_PATCH)
21 
22 #define nssv_STRINGIFY(x) nssv_STRINGIFY_(x)
23 #define nssv_STRINGIFY_(x) #x
24 
25 // string-view lite configuration:
26 
27 #define nssv_STRING_VIEW_DEFAULT 0
28 #define nssv_STRING_VIEW_NONSTD 1
29 #define nssv_STRING_VIEW_STD 2
30 
31 #if !defined(nssv_CONFIG_SELECT_STRING_VIEW)
32 #define nssv_CONFIG_SELECT_STRING_VIEW \
33  (nssv_HAVE_STD_STRING_VIEW ? nssv_STRING_VIEW_STD : nssv_STRING_VIEW_NONSTD)
34 #endif
35 
36 #if defined(nssv_CONFIG_SELECT_STD_STRING_VIEW) || \
37  defined(nssv_CONFIG_SELECT_NONSTD_STRING_VIEW)
38 #error nssv_CONFIG_SELECT_STD_STRING_VIEW and nssv_CONFIG_SELECT_NONSTD_STRING_VIEW are deprecated and removed, please use nssv_CONFIG_SELECT_STRING_VIEW=nssv_STRING_VIEW_...
39 #endif
40 
41 #ifndef nssv_CONFIG_STD_SV_OPERATOR
42 #define nssv_CONFIG_STD_SV_OPERATOR 0
43 #endif
44 
45 #ifndef nssv_CONFIG_USR_SV_OPERATOR
46 #define nssv_CONFIG_USR_SV_OPERATOR 1
47 #endif
48 
49 #ifdef nssv_CONFIG_CONVERSION_STD_STRING
50 #define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS nssv_CONFIG_CONVERSION_STD_STRING
51 #define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS nssv_CONFIG_CONVERSION_STD_STRING
52 #endif
53 
54 #ifndef nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
55 #define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS 1
56 #endif
57 
58 #ifndef nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
59 #define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS 1
60 #endif
61 
62 // C++ language version detection (C++20 is speculative):
63 // Note: VC14.0/1900 (VS2015) lacks too much from C++14.
64 
65 #ifndef nssv_CPLUSPLUS
66 #if defined(_MSVC_LANG) && !defined(__clang__)
67 #define nssv_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
68 #else
69 #define nssv_CPLUSPLUS __cplusplus
70 #endif
71 #endif
72 
73 #define nssv_CPP98_OR_GREATER (nssv_CPLUSPLUS >= 199711L)
74 #define nssv_CPP11_OR_GREATER (nssv_CPLUSPLUS >= 201103L)
75 #define nssv_CPP11_OR_GREATER_ (nssv_CPLUSPLUS >= 201103L)
76 #define nssv_CPP14_OR_GREATER (nssv_CPLUSPLUS >= 201402L)
77 #define nssv_CPP17_OR_GREATER (nssv_CPLUSPLUS >= 201703L)
78 #define nssv_CPP20_OR_GREATER (nssv_CPLUSPLUS >= 202000L)
79 
80 #define nssv_HAVE_STD_STRING_VIEW 0
81 
82 #define nssv_USES_STD_STRING_VIEW \
83  ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_STD) || \
84  ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_DEFAULT) && \
85  nssv_HAVE_STD_STRING_VIEW))
86 
87 #define nssv_HAVE_STARTS_WITH (nssv_CPP20_OR_GREATER || !nssv_USES_STD_STRING_VIEW)
88 #define nssv_HAVE_ENDS_WITH nssv_HAVE_STARTS_WITH
89 
90 //
91 // Use C++17 std::string_view:
92 //
93 
94 #if nssv_USES_STD_STRING_VIEW
95 
96 #include <string_view>
97 
98 // Extensions for std::string:
99 
100 #if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
101 
102 namespace nonstd
103 {
104 
105 template <class CharT, class Traits, class Allocator = std::allocator<CharT> >
106 std::basic_string<CharT, Traits, Allocator>
107 to_string(std::basic_string_view<CharT, Traits> v, Allocator const& a = Allocator())
108 {
109  return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
110 }
111 
112 template <class CharT, class Traits, class Allocator>
113 std::basic_string_view<CharT, Traits>
114 to_string_view(std::basic_string<CharT, Traits, Allocator> const& s)
115 {
116  return std::basic_string_view<CharT, Traits>(s.data(), s.size());
117 }
118 
119 // Literal operators sv and _sv:
120 
121 #if nssv_CONFIG_STD_SV_OPERATOR
122 
123 using namespace std::literals::string_view_literals;
124 
125 #endif
126 
127 #if nssv_CONFIG_USR_SV_OPERATOR
128 
129 inline namespace literals
130 {
131 inline namespace string_view_literals
132 {
133 
134 constexpr std::string_view operator"" _sv(const char* str, size_t len) noexcept // (1)
135 {
136  return std::string_view{ str, len };
137 }
138 
139 constexpr std::u16string_view operator"" _sv(const char16_t* str,
140  size_t len) noexcept // (2)
141 {
142  return std::u16string_view{ str, len };
143 }
144 
145 constexpr std::u32string_view operator"" _sv(const char32_t* str,
146  size_t len) noexcept // (3)
147 {
148  return std::u32string_view{ str, len };
149 }
150 
151 constexpr std::wstring_view operator"" _sv(const wchar_t* str,
152  size_t len) noexcept // (4)
153 {
154  return std::wstring_view{ str, len };
155 }
156 
157 } // namespace string_view_literals
158 } // namespace literals
159 
160 #endif // nssv_CONFIG_USR_SV_OPERATOR
161 
162 } // namespace nonstd
163 
164 #endif // nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
165 
166 namespace nonstd
167 {
168 
170 using std::string_view;
171 using std::u16string_view;
172 using std::u32string_view;
173 using std::wstring_view;
174 
175 // literal "sv" and "_sv", see above
176 
177 using std::operator==;
178 using std::operator!=;
179 using std::operator<;
180 using std::operator<=;
181 using std::operator>;
182 using std::operator>=;
183 
184 using std::operator<<;
185 
186 } // namespace nonstd
187 
188 #else // nssv_HAVE_STD_STRING_VIEW
189 
190 //
191 // Before C++17: use string_view lite:
192 //
193 
194 // Compiler versions:
195 //
196 // MSVC++ 6.0 _MSC_VER == 1200 (Visual Studio 6.0)
197 // MSVC++ 7.0 _MSC_VER == 1300 (Visual Studio .NET 2002)
198 // MSVC++ 7.1 _MSC_VER == 1310 (Visual Studio .NET 2003)
199 // MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
200 // MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
201 // MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
202 // MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
203 // MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
204 // MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
205 // MSVC++ 14.1 _MSC_VER >= 1910 (Visual Studio 2017)
206 
207 #if defined(_MSC_VER) && !defined(__clang__)
208 #define nssv_COMPILER_MSVC_VER (_MSC_VER)
209 #define nssv_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * (5 + (_MSC_VER < 1900)))
210 #else
211 #define nssv_COMPILER_MSVC_VER 0
212 #define nssv_COMPILER_MSVC_VERSION 0
213 #endif
214 
215 #define nssv_COMPILER_VERSION(major, minor, patch) (10 * (10 * major + minor) + patch)
216 
217 #if defined(__clang__)
218 #define nssv_COMPILER_CLANG_VERSION \
219  nssv_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
220 #else
221 #define nssv_COMPILER_CLANG_VERSION 0
222 #endif
223 
224 #if defined(__GNUC__) && !defined(__clang__)
225 #define nssv_COMPILER_GNUC_VERSION \
226  nssv_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
227 #else
228 #define nssv_COMPILER_GNUC_VERSION 0
229 #endif
230 
231 // half-open range [lo..hi):
232 #define nssv_BETWEEN(v, lo, hi) ((lo) <= (v) && (v) < (hi))
233 
234 // Presence of language and library features:
235 
236 #ifdef _HAS_CPP0X
237 #define nssv_HAS_CPP0X _HAS_CPP0X
238 #else
239 #define nssv_HAS_CPP0X 0
240 #endif
241 
242 // Unless defined otherwise below, consider VC14 as C++11 for variant-lite:
243 
244 #if nssv_COMPILER_MSVC_VER >= 1900
245 #undef nssv_CPP11_OR_GREATER
246 #define nssv_CPP11_OR_GREATER 1
247 #endif
248 
249 #define nssv_CPP11_90 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1500)
250 #define nssv_CPP11_100 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1600)
251 #define nssv_CPP11_110 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1700)
252 #define nssv_CPP11_120 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1800)
253 #define nssv_CPP11_140 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1900)
254 #define nssv_CPP11_141 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1910)
255 
256 #define nssv_CPP14_000 (nssv_CPP14_OR_GREATER)
257 #define nssv_CPP17_000 (nssv_CPP17_OR_GREATER)
258 
259 // Presence of C++11 language features:
260 
261 #define nssv_HAVE_CONSTEXPR_11 nssv_CPP11_140
262 #define nssv_HAVE_EXPLICIT_CONVERSION nssv_CPP11_140
263 #define nssv_HAVE_INLINE_NAMESPACE nssv_CPP11_140
264 #define nssv_HAVE_NOEXCEPT nssv_CPP11_140
265 #define nssv_HAVE_NULLPTR nssv_CPP11_100
266 #define nssv_HAVE_REF_QUALIFIER nssv_CPP11_140
267 #define nssv_HAVE_UNICODE_LITERALS nssv_CPP11_140
268 #define nssv_HAVE_USER_DEFINED_LITERALS nssv_CPP11_140
269 #define nssv_HAVE_WCHAR16_T nssv_CPP11_100
270 #define nssv_HAVE_WCHAR32_T nssv_CPP11_100
271 
272 #if !((nssv_CPP11 && nssv_COMPILER_CLANG_VERSION) || \
273  nssv_BETWEEN(nssv_COMPILER_CLANG_VERSION, 300, 400))
274 #define nssv_HAVE_STD_DEFINED_LITERALS nssv_CPP11_140
275 #endif
276 
277 // Presence of C++14 language features:
278 
279 #define nssv_HAVE_CONSTEXPR_14 nssv_CPP14_000
280 
281 // Presence of C++17 language features:
282 
283 #define nssv_HAVE_NODISCARD nssv_CPP17_000
284 
285 // Presence of C++ library features:
286 
287 #define nssv_HAVE_STD_HASH nssv_CPP11_120
288 
289 // C++ feature usage:
290 
291 #if nssv_HAVE_CONSTEXPR_11
292 #define nssv_constexpr constexpr
293 #else
294 #define nssv_constexpr /*constexpr*/
295 #endif
296 
297 #if nssv_HAVE_CONSTEXPR_14
298 #define nssv_constexpr14 constexpr
299 #else
300 #define nssv_constexpr14 /*constexpr*/
301 #endif
302 
303 #if nssv_HAVE_EXPLICIT_CONVERSION
304 #define nssv_explicit explicit
305 #else
306 #define nssv_explicit /*explicit*/
307 #endif
308 
309 #if nssv_HAVE_INLINE_NAMESPACE
310 #define nssv_inline_ns inline
311 #else
312 #define nssv_inline_ns /*inline*/
313 #endif
314 
315 #if nssv_HAVE_NOEXCEPT
316 #define nssv_noexcept noexcept
317 #else
318 #define nssv_noexcept /*noexcept*/
319 #endif
320 
321 // #if nssv_HAVE_REF_QUALIFIER
322 // # define nssv_ref_qual &
323 // # define nssv_refref_qual &&
324 // #else
325 // # define nssv_ref_qual /*&*/
326 // # define nssv_refref_qual /*&&*/
327 // #endif
328 
329 #if nssv_HAVE_NULLPTR
330 #define nssv_nullptr nullptr
331 #else
332 #define nssv_nullptr NULL
333 #endif
334 
335 #if nssv_HAVE_NODISCARD
336 #define nssv_nodiscard [[nodiscard]]
337 #else
338 #define nssv_nodiscard /*[[nodiscard]]*/
339 #endif
340 
341 // Additional includes:
342 
343 #include <algorithm>
344 #include <cassert>
345 #include <iterator>
346 #include <limits>
347 #include <ostream>
348 #include <stdexcept>
349 #include <string> // std::char_traits<>
350 
351 #if nssv_CPP11_OR_GREATER
352 #include <type_traits>
353 #endif
354 
355 // Clang, GNUC, MSVC warning suppression macros:
356 
357 #if defined(__clang__)
358 #pragma clang diagnostic ignored "-Wreserved-user-defined-literal"
359 #pragma clang diagnostic push
360 #pragma clang diagnostic ignored "-Wuser-defined-literals"
361 #elif defined(__GNUC__)
362 #pragma GCC diagnostic push
363 #pragma GCC diagnostic ignored "-Wliteral-suffix"
364 #endif // __clang__
365 
366 #if nssv_COMPILER_MSVC_VERSION >= 140
367 #define nssv_SUPPRESS_MSGSL_WARNING(expr) [[gsl::suppress(expr)]]
368 #define nssv_SUPPRESS_MSVC_WARNING(code, descr) __pragma(warning(suppress : code))
369 #define nssv_DISABLE_MSVC_WARNINGS(codes) \
370  __pragma(warning(push)) __pragma(warning(disable : codes))
371 #else
372 #define nssv_SUPPRESS_MSGSL_WARNING(expr)
373 #define nssv_SUPPRESS_MSVC_WARNING(code, descr)
374 #define nssv_DISABLE_MSVC_WARNINGS(codes)
375 #endif
376 
377 #if defined(__clang__)
378 #define nssv_RESTORE_WARNINGS() _Pragma("clang diagnostic pop")
379 #elif defined(__GNUC__)
380 #define nssv_RESTORE_WARNINGS() _Pragma("GCC diagnostic pop")
381 #elif nssv_COMPILER_MSVC_VERSION >= 140
382 #define nssv_RESTORE_WARNINGS() __pragma(warning(pop))
383 #else
384 #define nssv_RESTORE_WARNINGS()
385 #endif
386 
387 // Suppress the following MSVC (GSL) warnings:
388 // - C4455, non-gsl : 'operator ""sv': literal suffix identifiers that do not
389 // start with an underscore are reserved
390 // - C26472, gsl::t.1 : don't use a static_cast for arithmetic conversions;
391 // use brace initialization, gsl::narrow_cast or gsl::narow
392 // - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead
393 
394 nssv_DISABLE_MSVC_WARNINGS(4455 26481 26472)
395  // nssv_DISABLE_CLANG_WARNINGS( "-Wuser-defined-literals" )
396  // nssv_DISABLE_GNUC_WARNINGS( -Wliteral-suffix )
397 
398  namespace nonstd
399 {
400  namespace sv_lite
401  {
402 
403  template <class CharT, class Traits = std::char_traits<CharT> >
404  class basic_string_view;
405 
406  //
407  // basic_string_view:
408  //
409 
410  template <class CharT, class Traits /* = std::char_traits<CharT> */
411  >
412  class basic_string_view
413  {
414  public:
415  // Member types:
416 
417  typedef Traits traits_type;
418  typedef CharT value_type;
419 
420  typedef CharT* pointer;
421  typedef CharT const* const_pointer;
422  typedef CharT& reference;
423  typedef CharT const& const_reference;
424 
425  typedef const_pointer iterator;
426  typedef const_pointer const_iterator;
427  typedef std::reverse_iterator<const_iterator> reverse_iterator;
428  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
429 
430  typedef std::size_t size_type;
431  typedef std::ptrdiff_t difference_type;
432 
433  // 24.4.2.1 Construction and assignment:
434 
436  {
437  }
438 
439 #if nssv_CPP11_OR_GREATER
441  basic_string_view(basic_string_view const& other) nssv_noexcept = default;
442 #else
444  : data_(other.data_),
445  size_(other.size_)
446  {
447  }
448 #endif
449 
450  nssv_constexpr basic_string_view(CharT const* s, size_type count)
451  : data_(s), size_(count)
452  {
453  }
454 
455  nssv_constexpr basic_string_view(CharT const* s) : data_(s), size_(Traits::length(s))
456  {
457  }
458 
459  // Assignment:
460 
461 #if nssv_CPP11_OR_GREATER
463  operator=(basic_string_view const& other) nssv_noexcept = default;
464 #else
466  operator=(basic_string_view const& other) nssv_noexcept
467  {
468  data_ = other.data_;
469  size_ = other.size_;
470  return *this;
471  }
472 #endif
473 
474  // 24.4.2.2 Iterator support:
475 
476  nssv_constexpr const_iterator begin() const nssv_noexcept
477  {
478  return data_;
479  }
480  nssv_constexpr const_iterator end() const nssv_noexcept
481  {
482  return data_ + size_;
483  }
484 
485  nssv_constexpr const_iterator cbegin() const nssv_noexcept
486  {
487  return begin();
488  }
489  nssv_constexpr const_iterator cend() const nssv_noexcept
490  {
491  return end();
492  }
493 
494  nssv_constexpr const_reverse_iterator rbegin() const nssv_noexcept
495  {
496  return const_reverse_iterator(end());
497  }
498  nssv_constexpr const_reverse_iterator rend() const nssv_noexcept
499  {
500  return const_reverse_iterator(begin());
501  }
502 
503  nssv_constexpr const_reverse_iterator crbegin() const nssv_noexcept
504  {
505  return rbegin();
506  }
507  nssv_constexpr const_reverse_iterator crend() const nssv_noexcept
508  {
509  return rend();
510  }
511 
512  // 24.4.2.3 Capacity:
513 
514  nssv_constexpr size_type size() const nssv_noexcept
515  {
516  return size_;
517  }
518  nssv_constexpr size_type length() const nssv_noexcept
519  {
520  return size_;
521  }
522  nssv_constexpr size_type max_size() const nssv_noexcept
523  {
524  return (std::numeric_limits<size_type>::max)();
525  }
526 
527  // since C++20
528  nssv_nodiscard nssv_constexpr bool empty() const nssv_noexcept
529  {
530  return 0 == size_;
531  }
532 
533  // 24.4.2.4 Element access:
534 
535  nssv_constexpr const_reference operator[](size_type pos) const
536  {
537  return data_at(pos);
538  }
539 
540  nssv_constexpr14 const_reference at(size_type pos) const
541  {
542  if (pos < size())
543  {
544  return data_at(pos);
545  }
546 
547  throw std::out_of_range("nonst::string_view::at()");
548  }
549 
550  nssv_constexpr const_reference front() const
551  {
552  return data_at(0);
553  }
554  nssv_constexpr const_reference back() const
555  {
556  return data_at(size() - 1);
557  }
558 
559  nssv_constexpr const_pointer data() const nssv_noexcept
560  {
561  return data_;
562  }
563 
564  // 24.4.2.5 Modifiers:
565 
566  nssv_constexpr14 void remove_prefix(size_type n)
567  {
568  assert(n <= size());
569  data_ += n;
570  size_ -= n;
571  }
572 
573  nssv_constexpr14 void remove_suffix(size_type n)
574  {
575  assert(n <= size());
576  size_ -= n;
577  }
578 
580  {
581  using std::swap;
582  swap(data_, other.data_);
583  swap(size_, other.size_);
584  }
585 
586  // 24.4.2.6 String operations:
587 
588  size_type copy(CharT* dest, size_type n, size_type pos = 0) const
589  {
590  if (pos > size())
591  throw std::out_of_range("nonst::string_view::copy()");
592 
593  const size_type rlen = (std::min)(n, size() - pos);
594 
595  (void)Traits::copy(dest, data() + pos, rlen);
596 
597  return rlen;
598  }
599 
600  nssv_constexpr14 basic_string_view substr(size_type pos = 0, size_type n = npos) const
601  {
602  if (pos > size())
603  throw std::out_of_range("nonst::string_view::substr()");
604 
605  return basic_string_view(data() + pos, (std::min)(n, size() - pos));
606  }
607 
608  // compare(), 6x:
609 
610  nssv_constexpr14 int compare(basic_string_view other) const nssv_noexcept // (1)
611  {
612  if (const int result =
613  Traits::compare(data(), other.data(), (std::min)(size(), other.size())))
614  return result;
615 
616  return size() == other.size() ? 0 : size() < other.size() ? -1 : 1;
617  }
618 
619  nssv_constexpr int compare(size_type pos1, size_type n1,
620  basic_string_view other) const // (2)
621  {
622  return substr(pos1, n1).compare(other);
623  }
624 
625  nssv_constexpr int compare(size_type pos1, size_type n1, basic_string_view other,
626  size_type pos2, size_type n2) const // (3)
627  {
628  return substr(pos1, n1).compare(other.substr(pos2, n2));
629  }
630 
631  nssv_constexpr int compare(CharT const* s) const // (4)
632  {
633  return compare(basic_string_view(s));
634  }
635 
636  nssv_constexpr int compare(size_type pos1, size_type n1, CharT const* s) const // (5)
637  {
638  return substr(pos1, n1).compare(basic_string_view(s));
639  }
640 
641  nssv_constexpr int compare(size_type pos1, size_type n1, CharT const* s,
642  size_type n2) const // (6)
643  {
644  return substr(pos1, n1).compare(basic_string_view(s, n2));
645  }
646 
647  // 24.4.2.7 Searching:
648 
649  // starts_with(), 3x, since C++20:
650 
651  nssv_constexpr bool starts_with(basic_string_view v) const nssv_noexcept // (1)
652  {
653  return size() >= v.size() && compare(0, v.size(), v) == 0;
654  }
655 
656  nssv_constexpr bool starts_with(CharT c) const nssv_noexcept // (2)
657  {
658  return starts_with(basic_string_view(&c, 1));
659  }
660 
661  nssv_constexpr bool starts_with(CharT const* s) const // (3)
662  {
663  return starts_with(basic_string_view(s));
664  }
665 
666  // ends_with(), 3x, since C++20:
667 
668  nssv_constexpr bool ends_with(basic_string_view v) const nssv_noexcept // (1)
669  {
670  return size() >= v.size() && compare(size() - v.size(), npos, v) == 0;
671  }
672 
673  nssv_constexpr bool ends_with(CharT c) const nssv_noexcept // (2)
674  {
675  return ends_with(basic_string_view(&c, 1));
676  }
677 
678  nssv_constexpr bool ends_with(CharT const* s) const // (3)
679  {
680  return ends_with(basic_string_view(s));
681  }
682 
683  // find(), 4x:
684 
686  size_type pos = 0) const nssv_noexcept // (1)
687  {
688  return assert(v.size() == 0 || v.data() != nssv_nullptr),
689  pos >= size() ? npos :
690  to_pos(std::search(cbegin() + pos, cend(), v.cbegin(),
691  v.cend(), Traits::eq));
692  }
693 
694  nssv_constexpr14 size_type find(CharT c,
695  size_type pos = 0) const nssv_noexcept // (2)
696  {
697  return find(basic_string_view(&c, 1), pos);
698  }
699 
700  nssv_constexpr14 size_type find(CharT const* s, size_type pos,
701  size_type n) const // (3)
702  {
703  return find(basic_string_view(s, n), pos);
704  }
705 
706  nssv_constexpr14 size_type find(CharT const* s, size_type pos = 0) const // (4)
707  {
708  return find(basic_string_view(s), pos);
709  }
710 
711  // rfind(), 4x:
712 
713  nssv_constexpr14 size_type rfind(basic_string_view v,
714  size_type pos = npos) const nssv_noexcept // (1)
715  {
716  if (size() < v.size())
717  return npos;
718 
719  if (v.empty())
720  return (std::min)(size(), pos);
721 
722  const_iterator last = cbegin() + (std::min)(size() - v.size(), pos) + v.size();
723  const_iterator result =
724  std::find_end(cbegin(), last, v.cbegin(), v.cend(), Traits::eq);
725 
726  return result != last ? size_type(result - cbegin()) : npos;
727  }
728 
729  nssv_constexpr14 size_type rfind(CharT c,
730  size_type pos = npos) const nssv_noexcept // (2)
731  {
732  return rfind(basic_string_view(&c, 1), pos);
733  }
734 
735  nssv_constexpr14 size_type rfind(CharT const* s, size_type pos,
736  size_type n) const // (3)
737  {
738  return rfind(basic_string_view(s, n), pos);
739  }
740 
741  nssv_constexpr14 size_type rfind(CharT const* s, size_type pos = npos) const // (4)
742  {
743  return rfind(basic_string_view(s), pos);
744  }
745 
746  // find_first_of(), 4x:
747 
748  nssv_constexpr size_type find_first_of(basic_string_view v,
749  size_type pos = 0) const nssv_noexcept // (1)
750  {
751  return pos >= size() ? npos :
752  to_pos(std::find_first_of(cbegin() + pos, cend(), v.cbegin(),
753  v.cend(), Traits::eq));
754  }
755 
756  nssv_constexpr size_type find_first_of(CharT c,
757  size_type pos = 0) const nssv_noexcept // (2)
758  {
759  return find_first_of(basic_string_view(&c, 1), pos);
760  }
761 
762  nssv_constexpr size_type find_first_of(CharT const* s, size_type pos,
763  size_type n) const // (3)
764  {
765  return find_first_of(basic_string_view(s, n), pos);
766  }
767 
768  nssv_constexpr size_type find_first_of(CharT const* s,
769  size_type pos = 0) const // (4)
770  {
771  return find_first_of(basic_string_view(s), pos);
772  }
773 
774  // find_last_of(), 4x:
775 
776  nssv_constexpr size_type
777  find_last_of(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
778  {
779  return empty() ?
780  npos :
781  pos >= size() ?
782  find_last_of(v, size() - 1) :
783  to_pos(std::find_first_of(const_reverse_iterator(cbegin() + pos + 1),
784  crend(), v.cbegin(), v.cend(), Traits::eq));
785  }
786 
787  nssv_constexpr size_type
788  find_last_of(CharT c, size_type pos = npos) const nssv_noexcept // (2)
789  {
790  return find_last_of(basic_string_view(&c, 1), pos);
791  }
792 
793  nssv_constexpr size_type find_last_of(CharT const* s, size_type pos,
794  size_type count) const // (3)
795  {
796  return find_last_of(basic_string_view(s, count), pos);
797  }
798 
799  nssv_constexpr size_type find_last_of(CharT const* s,
800  size_type pos = npos) const // (4)
801  {
802  return find_last_of(basic_string_view(s), pos);
803  }
804 
805  // find_first_not_of(), 4x:
806 
807  nssv_constexpr size_type
808  find_first_not_of(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
809  {
810  return pos >= size() ? npos :
811  to_pos(std::find_if(cbegin() + pos, cend(), not_in_view(v)));
812  }
813 
814  nssv_constexpr size_type
815  find_first_not_of(CharT c, size_type pos = 0) const nssv_noexcept // (2)
816  {
817  return find_first_not_of(basic_string_view(&c, 1), pos);
818  }
819 
820  nssv_constexpr size_type find_first_not_of(CharT const* s, size_type pos,
821  size_type count) const // (3)
822  {
823  return find_first_not_of(basic_string_view(s, count), pos);
824  }
825 
826  nssv_constexpr size_type find_first_not_of(CharT const* s,
827  size_type pos = 0) const // (4)
828  {
829  return find_first_not_of(basic_string_view(s), pos);
830  }
831 
832  // find_last_not_of(), 4x:
833 
834  nssv_constexpr size_type find_last_not_of(
835  basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
836  {
837  return empty() ? npos :
838  pos >= size() ?
839  find_last_not_of(v, size() - 1) :
840  to_pos(std::find_if(const_reverse_iterator(cbegin() + pos + 1),
841  crend(), not_in_view(v)));
842  }
843 
844  nssv_constexpr size_type
845  find_last_not_of(CharT c, size_type pos = npos) const nssv_noexcept // (2)
846  {
847  return find_last_not_of(basic_string_view(&c, 1), pos);
848  }
849 
850  nssv_constexpr size_type find_last_not_of(CharT const* s, size_type pos,
851  size_type count) const // (3)
852  {
853  return find_last_not_of(basic_string_view(s, count), pos);
854  }
855 
856  nssv_constexpr size_type find_last_not_of(CharT const* s,
857  size_type pos = npos) const // (4)
858  {
859  return find_last_not_of(basic_string_view(s), pos);
860  }
861 
862  // Constants:
863 
864 #if nssv_CPP17_OR_GREATER
865  static nssv_constexpr size_type npos = size_type(-1);
866 #elif nssv_CPP11_OR_GREATER
867  enum : size_type
868  {
869  npos = size_type(-1)
870  };
871 #else
872  enum
873  {
874  npos = size_type(-1)
875  };
876 #endif
877 
878  private:
879  struct not_in_view
880  {
881  const basic_string_view v;
882 
883  nssv_constexpr not_in_view(basic_string_view v) : v(v)
884  {
885  }
886 
887  nssv_constexpr bool operator()(CharT c) const
888  {
889  return npos == v.find_first_of(c);
890  }
891  };
892 
893  nssv_constexpr size_type to_pos(const_iterator it) const
894  {
895  return it == cend() ? npos : size_type(it - cbegin());
896  }
897 
898  nssv_constexpr size_type to_pos(const_reverse_iterator it) const
899  {
900  return it == crend() ? npos : size_type(crend() - it - 1);
901  }
902 
903  nssv_constexpr const_reference data_at(size_type pos) const
904  {
905 #if nssv_BETWEEN(nssv_COMPILER_GNUC_VERSION, 1, 500)
906  return data_[pos];
907 #else
908  return assert(pos < size()), data_[pos];
909 #endif
910  }
911 
912  private:
913  const_pointer data_;
914  size_type size_;
915 
916  public:
917 #if nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
918 
919  template <class Allocator>
920  basic_string_view(std::basic_string<CharT, Traits, Allocator> const& s) nssv_noexcept
921  : data_(s.data()),
922  size_(s.size())
923  {
924  }
925 
926 #if nssv_HAVE_EXPLICIT_CONVERSION
927 
928  template <class Allocator>
929  explicit operator std::basic_string<CharT, Traits, Allocator>() const
930  {
931  return to_string(Allocator());
932  }
933 
934 #endif // nssv_HAVE_EXPLICIT_CONVERSION
935 
936 #if nssv_CPP11_OR_GREATER
937 
938  template <class Allocator = std::allocator<CharT> >
939  std::basic_string<CharT, Traits, Allocator>
940  to_string(Allocator const& a = Allocator()) const
941  {
942  return std::basic_string<CharT, Traits, Allocator>(begin(), end(), a);
943  }
944 
945 #else
946 
947  std::basic_string<CharT, Traits> to_string() const
948  {
949  return std::basic_string<CharT, Traits>(begin(), end());
950  }
951 
952  template <class Allocator>
953  std::basic_string<CharT, Traits, Allocator> to_string(Allocator const& a) const
954  {
955  return std::basic_string<CharT, Traits, Allocator>(begin(), end(), a);
956  }
957 
958 #endif // nssv_CPP11_OR_GREATER
959 
960 #endif // nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
961  };
962 
963  //
964  // Non-member functions:
965  //
966 
967  // 24.4.3 Non-member comparison functions:
968  // lexicographically compare two string views (function template):
969 
970  template <class CharT, class Traits>
973  {
974  return lhs.compare(rhs) == 0;
975  }
976 
977  template <class CharT, class Traits>
980  {
981  return lhs.compare(rhs) != 0;
982  }
983 
984  template <class CharT, class Traits>
987  {
988  return lhs.compare(rhs) < 0;
989  }
990 
991  template <class CharT, class Traits>
994  {
995  return lhs.compare(rhs) <= 0;
996  }
997 
998  template <class CharT, class Traits>
1001  {
1002  return lhs.compare(rhs) > 0;
1003  }
1004 
1005  template <class CharT, class Traits>
1008  {
1009  return lhs.compare(rhs) >= 0;
1010  }
1011 
1012  // Let S be basic_string_view<CharT, Traits>, and sv be an instance of S.
1013  // Implementations shall provide sufficient additional overloads marked
1014  // constexpr and noexcept so that an object t with an implicit conversion
1015  // to S can be compared according to Table 67.
1016 
1017 #if nssv_CPP11_OR_GREATER && !nssv_BETWEEN(nssv_COMPILER_MSVC_VERSION, 100, 141)
1018 
1019 #define nssv_BASIC_STRING_VIEW_I(T, U) typename std::decay<basic_string_view<T, U> >::type
1020 
1021 #if nssv_BETWEEN(nssv_COMPILER_MSVC_VERSION, 140, 150)
1022 #define nssv_MSVC_ORDER(x) , int = x
1023 #else
1024 #define nssv_MSVC_ORDER(x) /*, int=x*/
1025 #endif
1026 
1027  // ==
1028 
1029  template <class CharT, class Traits nssv_MSVC_ORDER(1)>
1031  nssv_BASIC_STRING_VIEW_I(CharT, Traits)
1032  rhs) nssv_noexcept
1033  {
1034  return lhs.compare(rhs) == 0;
1035  }
1036 
1037  template <class CharT, class Traits nssv_MSVC_ORDER(2)>
1038  nssv_constexpr bool operator==(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
1040  {
1041  return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
1042  }
1043 
1044  // !=
1045 
1046  template <class CharT, class Traits nssv_MSVC_ORDER(1)>
1048  nssv_BASIC_STRING_VIEW_I(CharT, Traits)
1049  rhs) nssv_noexcept
1050  {
1051  return lhs.size() != rhs.size() || lhs.compare(rhs) != 0;
1052  }
1053 
1054  template <class CharT, class Traits nssv_MSVC_ORDER(2)>
1055  nssv_constexpr bool operator!=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
1057  {
1058  return lhs.compare(rhs) != 0;
1059  }
1060 
1061  // <
1062 
1063  template <class CharT, class Traits nssv_MSVC_ORDER(1)>
1065  nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept
1066  {
1067  return lhs.compare(rhs) < 0;
1068  }
1069 
1070  template <class CharT, class Traits nssv_MSVC_ORDER(2)>
1071  nssv_constexpr bool operator<(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
1073  {
1074  return lhs.compare(rhs) < 0;
1075  }
1076 
1077  // <=
1078 
1079  template <class CharT, class Traits nssv_MSVC_ORDER(1)>
1081  nssv_BASIC_STRING_VIEW_I(CharT, Traits)
1082  rhs) nssv_noexcept
1083  {
1084  return lhs.compare(rhs) <= 0;
1085  }
1086 
1087  template <class CharT, class Traits nssv_MSVC_ORDER(2)>
1088  nssv_constexpr bool operator<=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
1090  {
1091  return lhs.compare(rhs) <= 0;
1092  }
1093 
1094  // >
1095 
1096  template <class CharT, class Traits nssv_MSVC_ORDER(1)>
1098  nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept
1099  {
1100  return lhs.compare(rhs) > 0;
1101  }
1102 
1103  template <class CharT, class Traits nssv_MSVC_ORDER(2)>
1104  nssv_constexpr bool operator>(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
1106  {
1107  return lhs.compare(rhs) > 0;
1108  }
1109 
1110  // >=
1111 
1112  template <class CharT, class Traits nssv_MSVC_ORDER(1)>
1114  nssv_BASIC_STRING_VIEW_I(CharT, Traits)
1115  rhs) nssv_noexcept
1116  {
1117  return lhs.compare(rhs) >= 0;
1118  }
1119 
1120  template <class CharT, class Traits nssv_MSVC_ORDER(2)>
1121  nssv_constexpr bool operator>=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
1123  {
1124  return lhs.compare(rhs) >= 0;
1125  }
1126 
1127 #undef nssv_MSVC_ORDER
1128 #undef nssv_BASIC_STRING_VIEW_I
1129 
1130 #endif // nssv_CPP11_OR_GREATER
1131 
1132  // 24.4.4 Inserters and extractors:
1133 
1134  namespace detail
1135  {
1136 
1137  template <class Stream>
1138  void write_padding(Stream& os, std::streamsize n)
1139  {
1140  for (std::streamsize i = 0; i < n; ++i)
1141  os.rdbuf()->sputc(os.fill());
1142  }
1143 
1144  template <class Stream, class View>
1145  Stream& write_to_stream(Stream& os, View const& sv)
1146  {
1147  typename Stream::sentry sentry(os);
1148 
1149  if (!os)
1150  return os;
1151 
1152  const std::streamsize length = static_cast<std::streamsize>(sv.length());
1153 
1154  // Whether, and how, to pad:
1155  const bool pad = (length < os.width());
1156  const bool left_pad =
1157  pad && (os.flags() & std::ios_base::adjustfield) == std::ios_base::right;
1158 
1159  if (left_pad)
1160  write_padding(os, os.width() - length);
1161 
1162  // Write span characters:
1163  os.rdbuf()->sputn(sv.begin(), length);
1164 
1165  if (pad && !left_pad)
1166  write_padding(os, os.width() - length);
1167 
1168  // Reset output stream width:
1169  os.width(0);
1170 
1171  return os;
1172  }
1173 
1174  } // namespace detail
1175 
1176  template <class CharT, class Traits>
1177  std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os,
1179  {
1180  return detail::write_to_stream(os, sv);
1181  }
1182 
1183  // Several typedefs for common character types are provided:
1184 
1187 #if nssv_HAVE_WCHAR16_T
1190 #endif
1191 
1192  } // namespace sv_lite
1193 } // namespace nonstd::sv_lite
1194 
1195 //
1196 // 24.4.6 Suffix for basic_string_view literals:
1197 //
1198 
1199 #if nssv_HAVE_USER_DEFINED_LITERALS
1200 
1201 namespace nonstd
1202 {
1203 nssv_inline_ns namespace literals
1204 {
1205  nssv_inline_ns namespace string_view_literals
1206  {
1207 
1208 #if nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
1209 
1210  nssv_constexpr nonstd::sv_lite::string_view operator"" sv(const char* str, size_t len)
1211  nssv_noexcept // (1)
1212  {
1213  return nonstd::sv_lite::string_view{ str, len };
1214  }
1215 
1217  const char16_t* str, size_t len) nssv_noexcept // (2)
1218  {
1219  return nonstd::sv_lite::u16string_view{ str, len };
1220  }
1221 
1223  const char32_t* str, size_t len) nssv_noexcept // (3)
1224  {
1225  return nonstd::sv_lite::u32string_view{ str, len };
1226  }
1227 
1229  const wchar_t* str, size_t len) nssv_noexcept // (4)
1230  {
1231  return nonstd::sv_lite::wstring_view{ str, len };
1232  }
1233 
1234 #endif // nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
1235 
1236 #if nssv_CONFIG_USR_SV_OPERATOR
1237 
1239  const char* str, size_t len) nssv_noexcept // (1)
1240  {
1241  return nonstd::sv_lite::string_view{ str, len };
1242  }
1243 
1245  const char16_t* str, size_t len) nssv_noexcept // (2)
1246  {
1247  return nonstd::sv_lite::u16string_view{ str, len };
1248  }
1249 
1251  const char32_t* str, size_t len) nssv_noexcept // (3)
1252  {
1253  return nonstd::sv_lite::u32string_view{ str, len };
1254  }
1255 
1257  const wchar_t* str, size_t len) nssv_noexcept // (4)
1258  {
1259  return nonstd::sv_lite::wstring_view{ str, len };
1260  }
1261 
1262 #endif // nssv_CONFIG_USR_SV_OPERATOR
1263  }
1264 }
1265 } // namespace nonstd
1266 
1267 #endif
1268 
1269 //
1270 // Extensions for std::string:
1271 //
1272 
1273 #if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
1274 
1275 namespace nonstd
1276 {
1277 namespace sv_lite
1278 {
1279 
1280 // Exclude MSVC 14 (19.00): it yields ambiguous to_string():
1281 
1282 #if nssv_CPP11_OR_GREATER && nssv_COMPILER_MSVC_VERSION != 140
1283 
1284 template <class CharT, class Traits, class Allocator = std::allocator<CharT> >
1285 std::basic_string<CharT, Traits, Allocator> to_string(basic_string_view<CharT, Traits> v,
1286  Allocator const& a = Allocator())
1287 {
1288  return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
1289 }
1290 
1291 #else
1292 
1293 template <class CharT, class Traits>
1294 std::basic_string<CharT, Traits> to_string(basic_string_view<CharT, Traits> v)
1295 {
1296  return std::basic_string<CharT, Traits>(v.begin(), v.end());
1297 }
1298 
1299 template <class CharT, class Traits, class Allocator>
1300 std::basic_string<CharT, Traits, Allocator> to_string(basic_string_view<CharT, Traits> v,
1301  Allocator const& a)
1302 {
1303  return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
1304 }
1305 
1306 #endif // nssv_CPP11_OR_GREATER
1307 
1308 template <class CharT, class Traits, class Allocator>
1309 basic_string_view<CharT, Traits>
1310 to_string_view(std::basic_string<CharT, Traits, Allocator> const& s)
1311 {
1312  return basic_string_view<CharT, Traits>(s.data(), s.size());
1313 }
1314 
1315 } // namespace sv_lite
1316 } // namespace nonstd
1317 
1318 #endif // nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
1319 
1320 //
1321 // make types and algorithms available in namespace nonstd:
1322 //
1323 
1324 namespace nonstd
1325 {
1326 
1328 using sv_lite::string_view;
1329 using sv_lite::wstring_view;
1330 
1331 #if nssv_HAVE_WCHAR16_T
1333 #endif
1334 #if nssv_HAVE_WCHAR32_T
1336 #endif
1337 
1338 // literal "sv"
1339 
1340 using sv_lite::operator==;
1341 using sv_lite::operator!=;
1342 using sv_lite::operator<;
1343 using sv_lite::operator<=;
1344 using sv_lite::operator>;
1345 using sv_lite::operator>=;
1346 
1347 using sv_lite::operator<<;
1348 
1349 #if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
1350 using sv_lite::to_string;
1352 #endif
1353 
1354 } // namespace nonstd
1355 
1356 // 24.4.5 Hash support (C++11):
1357 
1358 // Note: The hash value of a string view object is equal to the hash value of
1359 // the corresponding string object.
1360 
1361 #if nssv_HAVE_STD_HASH
1362 
1363 #include <functional>
1364 
1365 namespace std
1366 {
1367 
1368 template <>
1369 struct hash<nonstd::string_view>
1370 {
1371 public:
1372  std::size_t operator()(nonstd::string_view v) const nssv_noexcept
1373  {
1374  return std::hash<std::string>()(std::string(v.data(), v.size()));
1375  }
1376 };
1377 
1378 template <>
1379 struct hash<nonstd::wstring_view>
1380 {
1381 public:
1382  std::size_t operator()(nonstd::wstring_view v) const nssv_noexcept
1383  {
1384  return std::hash<std::wstring>()(std::wstring(v.data(), v.size()));
1385  }
1386 };
1387 
1388 template <>
1389 struct hash<nonstd::u16string_view>
1390 {
1391 public:
1393  {
1394  return std::hash<std::u16string>()(std::u16string(v.data(), v.size()));
1395  }
1396 };
1397 
1398 template <>
1399 struct hash<nonstd::u32string_view>
1400 {
1401 public:
1403  {
1404  return std::hash<std::u32string>()(std::u32string(v.data(), v.size()));
1405  }
1406 };
1407 
1408 } // namespace std
1409 
1410 #endif // nssv_HAVE_STD_HASH
1411 
1413 
1414 #endif // nssv_HAVE_STD_STRING_VIEW
1415 #endif // NONSTD_SV_LITE_H_INCLUDED
nssv_constexpr
#define nssv_constexpr
Definition: string_view.hpp:294
nlohmann::detail::hash
std::size_t hash(const BasicJsonType &j)
hash a JSON value
Definition: json.hpp:5097
basic_string_view::data
constexpr auto data() const noexcept -> const Char *
Definition: core.h:457
detail::copy
auto copy(const Range &range, OutputIt out) -> OutputIt
Definition: ranges.h:22
basic_string_view::compare
FMT_CONSTEXPR_CHAR_TRAITS auto compare(basic_string_view other) const -> int
Definition: core.h:487
nssv_constexpr14
#define nssv_constexpr14
Definition: string_view.hpp:300
nssv_DISABLE_MSVC_WARNINGS
#define nssv_DISABLE_MSVC_WARNINGS(codes)
Definition: string_view.hpp:374
sol::u16string_view
std::u16string_view u16string_view
Definition: sol.hpp:2137
basic_string_view::size
constexpr auto size() const noexcept -> size_t
Definition: core.h:460
nonstd::span_lite::size_t
span_CONFIG_SIZE_TYPE size_t
Definition: span.hpp:576
basic_string_view
Definition: core.h:415
s
XmlRpcServer s
basic_string_view::data_
const Char * data_
Definition: core.h:417
literals
Definition: xchar.h:71
right
lu_byte right
Definition: lparser.c:1227
sol::operator>=
constexpr bool operator>=(const optional< T > &lhs, const optional< U > &rhs)
\group relop
Definition: sol.hpp:6040
detail
Definition: args.h:19
nssv_nodiscard
#define nssv_nodiscard
Definition: string_view.hpp:338
detail::find
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2154
sol::operator<=
constexpr bool operator<=(const optional< T > &lhs, const optional< U > &rhs)
\group relop
Definition: sol.hpp:6035
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
nonstd::sv_lite::to_string_view
basic_string_view< CharT, Traits > to_string_view(std::basic_string< CharT, Traits, Allocator > const &s)
Definition: string_view.hpp:1310
nonstd
Definition: ring_span.hpp:264
nlohmann::detail::operator<
bool operator<(const value_t lhs, const value_t rhs) noexcept
comparison operator for JSON types
Definition: json.hpp:156
operator==
bool operator==(QwtEventPattern::MousePattern b1, QwtEventPattern::MousePattern b2)
Compare operator.
Definition: qwt_event_pattern.h:228
std::swap
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.hpp:21884
sol::operator!=
constexpr bool operator!=(const optional< T > &lhs, const optional< U > &rhs)
\group relop
Definition: sol.hpp:6020
nlohmann::detail::void
j template void())
Definition: json.hpp:4061
detail::write_padding
auto write_padding(OutputIt out, pad_type pad, int width) -> OutputIt
Definition: chrono.h:660
nssv_inline_ns
#define nssv_inline_ns
Definition: string_view.hpp:312
string_view
basic_string_view< char > string_view
Definition: core.h:518
dest
char * dest
Definition: lz4.h:765
basic_string_view::size_
size_t size_
Definition: core.h:418
assert
#define assert(condition)
Definition: lz4.c:271
wstring_view
basic_string_view< wchar_t > wstring_view
Definition: xchar.h:42
std
nssv_noexcept
#define nssv_noexcept
Definition: string_view.hpp:318
sol::u32string_view
std::u32string_view u32string_view
Definition: sol.hpp:2138
mcap::internal::operator<<
std::ostream & operator<<(std::ostream &out, const Interval< Scalar, Value > &i)
Definition: intervaltree.hpp:37
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
sol::operator>
constexpr bool operator>(const optional< T > &lhs, const optional< U > &rhs)
\group relop
Definition: sol.hpp:6030
nssv_nullptr
#define nssv_nullptr
Definition: string_view.hpp:332
presentation_type::pointer
@ pointer
sol::basic_string_view
std::basic_string_view< C, T > basic_string_view
Definition: sol.hpp:2133
nssv_RESTORE_WARNINGS
#define nssv_RESTORE_WARNINGS()
Definition: string_view.hpp:384
nonstd::sv_lite::to_string
std::basic_string< CharT, Traits > to_string(basic_string_view< CharT, Traits > v)
Definition: string_view.hpp:1294


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:47