RESTinio

Namespaces | Macros | Functions
string_view.hpp File Reference
`#include <algorithm>`
`#include <cassert>`
`#include <iterator>`
`#include <limits>`
`#include <ostream>`
`#include <string>`

Go to the source code of this file.

## Namespaces
namespace | nonstd
namespace | nonstd::sv_lite

## Macros
#define | NONSTD_SV_LITE_H_INCLUDED
#define | string_view_lite_MAJOR 1
#define | string_view_lite_MINOR 6
#define | string_view_lite_PATCH 0
#define | string_view_lite_VERSION nssv_STRINGIFY(string_view_lite_MAJOR) "." nssv_STRINGIFY(string_view_lite_MINOR) "." nssv_STRINGIFY(string_view_lite_PATCH)
#define | nssv_STRINGIFY( x) nssv_STRINGIFY_( x )
#define | nssv_STRINGIFY_(x) #x
#define | nssv_STRING_VIEW_DEFAULT 0
#define | nssv_STRING_VIEW_NONSTD 1
#define | nssv_STRING_VIEW_STD 2
#define | nssv_HAVE_TWEAK_HEADER 0
#define | nssv_CONFIG_SELECT_STRING_VIEW ( nssv_HAVE_STD_STRING_VIEW ? nssv_STRING_VIEW_STD : nssv_STRING_VIEW_NONSTD )
#define | nssv_CONFIG_STD_SV_OPERATOR 0
#define | nssv_CONFIG_USR_SV_OPERATOR 1
#define | nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS 1
#define | nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS 1
#define | nssv_CONFIG_NO_EXCEPTIONS 1
#define | nssv_CPLUSPLUS __cplusplus
#define | nssv_CPP98_OR_GREATER ( nssv_CPLUSPLUS >= 199711L )
#define | nssv_CPP11_OR_GREATER ( nssv_CPLUSPLUS >= 201103L )
#define | nssv_CPP11_OR_GREATER_ ( nssv_CPLUSPLUS >= 201103L )
#define | nssv_CPP14_OR_GREATER ( nssv_CPLUSPLUS >= 201402L )
#define | nssv_CPP17_OR_GREATER ( nssv_CPLUSPLUS >= 201703L )
#define | nssv_CPP20_OR_GREATER ( nssv_CPLUSPLUS >= 202000L )
#define | nssv_HAVE_STD_STRING_VIEW 0
#define | nssv_USES_STD_STRING_VIEW ( (nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_STD) || ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_DEFAULT) && nssv_HAVE_STD_STRING_VIEW) )
#define | nssv_HAVE_STARTS_WITH ( nssv_CPP20_OR_GREATER || !nssv_USES_STD_STRING_VIEW )
#define | nssv_HAVE_ENDS_WITH nssv_HAVE_STARTS_WITH
#define | nssv_COMPILER_MSVC_VER 0
#define | nssv_COMPILER_MSVC_VERSION 0
#define | nssv_COMPILER_VERSION(major, minor, patch) ( 10 * ( 10 * (major) + (minor) ) + (patch) )
#define | nssv_COMPILER_APPLECLANG_VERSION 0
#define | nssv_COMPILER_CLANG_VERSION 0
#define | nssv_COMPILER_GNUC_VERSION 0
#define | nssv_BETWEEN(v, lo, hi) ( (lo) <= (v) && (v) < (hi) )
#define | nssv_HAS_CPP0X 0
#define | nssv_CPP11_90 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1500)
#define | nssv_CPP11_100 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1600)
#define | nssv_CPP11_110 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1700)
#define | nssv_CPP11_120 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1800)
#define | nssv_CPP11_140 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1900)
#define | nssv_CPP11_141 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1910)
#define | nssv_CPP14_000 (nssv_CPP14_OR_GREATER)
#define | nssv_CPP17_000 (nssv_CPP17_OR_GREATER)
#define | nssv_HAVE_CONSTEXPR_11 nssv_CPP11_140
#define | nssv_HAVE_EXPLICIT_CONVERSION nssv_CPP11_140
#define | nssv_HAVE_INLINE_NAMESPACE nssv_CPP11_140
#define | nssv_HAVE_NOEXCEPT nssv_CPP11_140
#define | nssv_HAVE_NULLPTR nssv_CPP11_100
#define | nssv_HAVE_REF_QUALIFIER nssv_CPP11_140
#define | nssv_HAVE_UNICODE_LITERALS nssv_CPP11_140
#define | nssv_HAVE_USER_DEFINED_LITERALS nssv_CPP11_140
#define | nssv_HAVE_WCHAR16_T nssv_CPP11_100
#define | nssv_HAVE_WCHAR32_T nssv_CPP11_100
#define | nssv_HAVE_STD_DEFINED_LITERALS nssv_CPP11_140
#define | nssv_HAVE_CONSTEXPR_14 nssv_CPP14_000
#define | nssv_HAVE_NODISCARD nssv_CPP17_000
#define | nssv_HAVE_STD_HASH nssv_CPP11_120
#define | nssv_HAVE_BUILTIN_VER ( (nssv_CPP17_000 && nssv_COMPILER_MSVC_VERSION >= 142) || nssv_COMPILER_GNUC_VERSION > 0 || nssv_COMPILER_CLANG_VERSION >= 400 || nssv_COMPILER_APPLECLANG_VERSION >= 900 )
#define | nssv_HAVE_BUILTIN_CE ( nssv_HAVE_BUILTIN_VER )
#define | nssv_HAVE_BUILTIN_MEMCMP ( (nssv_HAVE_CONSTEXPR_14 && nssv_HAVE_BUILTIN_CE) || !nssv_HAVE_CONSTEXPR_14 )
#define | nssv_HAVE_BUILTIN_STRLEN ( (nssv_HAVE_CONSTEXPR_11 && nssv_HAVE_BUILTIN_CE) || !nssv_HAVE_CONSTEXPR_11 )
#define | nssv_HAVE_BUILTIN(x) 0
#define | nssv_BUILTIN_MEMCMP memcmp
#define | nssv_BUILTIN_STRLEN strlen
#define | nssv_constexpr /*constexpr*/
#define | nssv_constexpr14 /*constexpr*/
#define | nssv_explicit /*explicit*/
#define | nssv_inline_ns /*inline*/
#define | nssv_noexcept /*noexcept*/
#define | nssv_nullptr NULL
#define | nssv_nodiscard /*[[nodiscard]]*/
#define | nssv_SUPPRESS_MSGSL_WARNING(expr)
#define | nssv_SUPPRESS_MSVC_WARNING(code, descr)
#define | nssv_DISABLE_MSVC_WARNINGS(codes)
#define | nssv_RESTORE_WARNINGS()

## Functions
| nssv_DISABLE_MSVC_WARNINGS (4455 26481 26472) namespace nonstd
template<class CharT , class Traits >
std::basic_string< CharT, Traits > | nonstd::sv_lite::to_string (basic_string_view< CharT, Traits > v)
template<class CharT , class Traits , class Allocator >
std::basic_string< CharT, Traits, Allocator > | nonstd::sv_lite::to_string (basic_string_view< CharT, Traits > v, Allocator const &a)
template<class CharT , class Traits , class Allocator >
basic_string_view< CharT, Traits > | nonstd::sv_lite::to_string_view (std::basic_string< CharT, Traits, Allocator > const &s)

## Macro Definition Documentation

## ◆ NONSTD_SV_LITE_H_INCLUDED

#define NONSTD_SV_LITE_H_INCLUDED

Definition at line 12 of file string_view.hpp.

## ◆ nssv_BETWEEN

#define nssv_BETWEEN | ( |  | v,
|  |  | lo,
|  |  | hi
| ) |  | ( (lo) <= (v) && (v) < (hi) )

Definition at line 256 of file string_view.hpp.

## ◆ nssv_BUILTIN_MEMCMP

#define nssv_BUILTIN_MEMCMP memcmp

Definition at line 344 of file string_view.hpp.

## ◆ nssv_BUILTIN_STRLEN

#define nssv_BUILTIN_STRLEN strlen

Definition at line 350 of file string_view.hpp.

## ◆ nssv_COMPILER_APPLECLANG_VERSION

#define nssv_COMPILER_APPLECLANG_VERSION 0

Definition at line 245 of file string_view.hpp.

## ◆ nssv_COMPILER_CLANG_VERSION

#define nssv_COMPILER_CLANG_VERSION 0

Definition at line 246 of file string_view.hpp.

## ◆ nssv_COMPILER_GNUC_VERSION

#define nssv_COMPILER_GNUC_VERSION 0

Definition at line 252 of file string_view.hpp.

## ◆ nssv_COMPILER_MSVC_VER

#define nssv_COMPILER_MSVC_VER 0

Definition at line 232 of file string_view.hpp.

## ◆ nssv_COMPILER_MSVC_VERSION

#define nssv_COMPILER_MSVC_VERSION 0

Definition at line 233 of file string_view.hpp.

## ◆ nssv_COMPILER_VERSION

#define nssv_COMPILER_VERSION | ( |  | major,
|  |  | minor,
|  |  | patch
| ) |  | ( 10 * ( 10 * (major) + (minor) ) + (patch) )

Definition at line 236 of file string_view.hpp.

## ◆ nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS

#define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS 1

Definition at line 65 of file string_view.hpp.

## ◆ nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS

#define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS 1

Definition at line 69 of file string_view.hpp.

## ◆ nssv_CONFIG_NO_EXCEPTIONS

#define nssv_CONFIG_NO_EXCEPTIONS 1

Definition at line 78 of file string_view.hpp.

## ◆ nssv_CONFIG_SELECT_STRING_VIEW

#define nssv_CONFIG_SELECT_STRING_VIEW ( nssv_HAVE_STD_STRING_VIEW ? nssv_STRING_VIEW_STD : nssv_STRING_VIEW_NONSTD )

Definition at line 44 of file string_view.hpp.

## ◆ nssv_CONFIG_STD_SV_OPERATOR

#define nssv_CONFIG_STD_SV_OPERATOR 0

Definition at line 52 of file string_view.hpp.

## ◆ nssv_CONFIG_USR_SV_OPERATOR

#define nssv_CONFIG_USR_SV_OPERATOR 1

Definition at line 56 of file string_view.hpp.

## ◆ nssv_constexpr

#define nssv_constexpr /*constexpr*/

Definition at line 358 of file string_view.hpp.

## ◆ nssv_constexpr14

#define nssv_constexpr14 /*constexpr*/

Definition at line 364 of file string_view.hpp.

## ◆ nssv_CPLUSPLUS

#define nssv_CPLUSPLUS __cplusplus

Definition at line 89 of file string_view.hpp.

## ◆ nssv_CPP11_100

#define nssv_CPP11_100 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1600)

Definition at line 274 of file string_view.hpp.

## ◆ nssv_CPP11_110

#define nssv_CPP11_110 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1700)

Definition at line 275 of file string_view.hpp.

## ◆ nssv_CPP11_120

#define nssv_CPP11_120 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1800)

Definition at line 276 of file string_view.hpp.

## ◆ nssv_CPP11_140

#define nssv_CPP11_140 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1900)

Definition at line 277 of file string_view.hpp.

## ◆ nssv_CPP11_141

#define nssv_CPP11_141 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1910)

Definition at line 278 of file string_view.hpp.

## ◆ nssv_CPP11_90

#define nssv_CPP11_90 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1500)

Definition at line 273 of file string_view.hpp.

## ◆ nssv_CPP11_OR_GREATER

#define nssv_CPP11_OR_GREATER ( nssv_CPLUSPLUS >= 201103L )

Definition at line 94 of file string_view.hpp.

## ◆ nssv_CPP11_OR_GREATER_

#define nssv_CPP11_OR_GREATER_ ( nssv_CPLUSPLUS >= 201103L )

Definition at line 95 of file string_view.hpp.

## ◆ nssv_CPP14_000

#define nssv_CPP14_000 (nssv_CPP14_OR_GREATER)

Definition at line 280 of file string_view.hpp.

## ◆ nssv_CPP14_OR_GREATER

#define nssv_CPP14_OR_GREATER ( nssv_CPLUSPLUS >= 201402L )

Definition at line 96 of file string_view.hpp.

## ◆ nssv_CPP17_000

#define nssv_CPP17_000 (nssv_CPP17_OR_GREATER)

Definition at line 281 of file string_view.hpp.

## ◆ nssv_CPP17_OR_GREATER

#define nssv_CPP17_OR_GREATER ( nssv_CPLUSPLUS >= 201703L )

Definition at line 97 of file string_view.hpp.

## ◆ nssv_CPP20_OR_GREATER

#define nssv_CPP20_OR_GREATER ( nssv_CPLUSPLUS >= 202000L )

Definition at line 98 of file string_view.hpp.

## ◆ nssv_CPP98_OR_GREATER

#define nssv_CPP98_OR_GREATER ( nssv_CPLUSPLUS >= 199711L )

Definition at line 93 of file string_view.hpp.

## ◆ nssv_DISABLE_MSVC_WARNINGS

#define nssv_DISABLE_MSVC_WARNINGS | ( |  | codes | ) |

Definition at line 440 of file string_view.hpp.

## ◆ nssv_explicit

#define nssv_explicit /*explicit*/

Definition at line 370 of file string_view.hpp.

## ◆ nssv_HAS_CPP0X

#define nssv_HAS_CPP0X 0

Definition at line 263 of file string_view.hpp.

## ◆ nssv_HAVE_BUILTIN

#define nssv_HAVE_BUILTIN | ( |  | x | ) | 0

Definition at line 338 of file string_view.hpp.

## ◆ nssv_HAVE_BUILTIN_CE

#define nssv_HAVE_BUILTIN_CE ( nssv_HAVE_BUILTIN_VER )

Definition at line 330 of file string_view.hpp.

## ◆ nssv_HAVE_BUILTIN_MEMCMP

#define nssv_HAVE_BUILTIN_MEMCMP ( (nssv_HAVE_CONSTEXPR_14 && nssv_HAVE_BUILTIN_CE) || !nssv_HAVE_CONSTEXPR_14 )

Definition at line 332 of file string_view.hpp.

## ◆ nssv_HAVE_BUILTIN_STRLEN

#define nssv_HAVE_BUILTIN_STRLEN ( (nssv_HAVE_CONSTEXPR_11 && nssv_HAVE_BUILTIN_CE) || !nssv_HAVE_CONSTEXPR_11 )

Definition at line 333 of file string_view.hpp.

## ◆ nssv_HAVE_BUILTIN_VER

#define nssv_HAVE_BUILTIN_VER ( (nssv_CPP17_000 && nssv_COMPILER_MSVC_VERSION >= 142) || nssv_COMPILER_GNUC_VERSION > 0 || nssv_COMPILER_CLANG_VERSION >= 400 || nssv_COMPILER_APPLECLANG_VERSION >= 900 )

Definition at line 329 of file string_view.hpp.

## ◆ nssv_HAVE_CONSTEXPR_11

#define nssv_HAVE_CONSTEXPR_11 nssv_CPP11_140

Definition at line 285 of file string_view.hpp.

## ◆ nssv_HAVE_CONSTEXPR_14

#define nssv_HAVE_CONSTEXPR_14 nssv_CPP14_000

Definition at line 304 of file string_view.hpp.

## ◆ nssv_HAVE_ENDS_WITH

#define nssv_HAVE_ENDS_WITH nssv_HAVE_STARTS_WITH

Definition at line 115 of file string_view.hpp.

## ◆ nssv_HAVE_EXPLICIT_CONVERSION

#define nssv_HAVE_EXPLICIT_CONVERSION nssv_CPP11_140

Definition at line 286 of file string_view.hpp.

## ◆ nssv_HAVE_INLINE_NAMESPACE

#define nssv_HAVE_INLINE_NAMESPACE nssv_CPP11_140

Definition at line 287 of file string_view.hpp.

## ◆ nssv_HAVE_NODISCARD

#define nssv_HAVE_NODISCARD nssv_CPP17_000

Definition at line 308 of file string_view.hpp.

## ◆ nssv_HAVE_NOEXCEPT

#define nssv_HAVE_NOEXCEPT nssv_CPP11_140

Definition at line 288 of file string_view.hpp.

## ◆ nssv_HAVE_NULLPTR

#define nssv_HAVE_NULLPTR nssv_CPP11_100

Definition at line 289 of file string_view.hpp.

## ◆ nssv_HAVE_REF_QUALIFIER

#define nssv_HAVE_REF_QUALIFIER nssv_CPP11_140

Definition at line 290 of file string_view.hpp.

## ◆ nssv_HAVE_STARTS_WITH

#define nssv_HAVE_STARTS_WITH ( nssv_CPP20_OR_GREATER || !nssv_USES_STD_STRING_VIEW )

Definition at line 114 of file string_view.hpp.

## ◆ nssv_HAVE_STD_DEFINED_LITERALS

#define nssv_HAVE_STD_DEFINED_LITERALS nssv_CPP11_140

Definition at line 297 of file string_view.hpp.

## ◆ nssv_HAVE_STD_HASH

#define nssv_HAVE_STD_HASH nssv_CPP11_120

Definition at line 312 of file string_view.hpp.

## ◆ nssv_HAVE_STD_STRING_VIEW

#define nssv_HAVE_STD_STRING_VIEW 0

Definition at line 109 of file string_view.hpp.

## ◆ nssv_HAVE_TWEAK_HEADER

#define nssv_HAVE_TWEAK_HEADER 0

Definition at line 37 of file string_view.hpp.

## ◆ nssv_HAVE_UNICODE_LITERALS

#define nssv_HAVE_UNICODE_LITERALS nssv_CPP11_140

Definition at line 291 of file string_view.hpp.

## ◆ nssv_HAVE_USER_DEFINED_LITERALS

#define nssv_HAVE_USER_DEFINED_LITERALS nssv_CPP11_140

Definition at line 292 of file string_view.hpp.

## ◆ nssv_HAVE_WCHAR16_T

#define nssv_HAVE_WCHAR16_T nssv_CPP11_100

Definition at line 293 of file string_view.hpp.

## ◆ nssv_HAVE_WCHAR32_T

#define nssv_HAVE_WCHAR32_T nssv_CPP11_100

Definition at line 294 of file string_view.hpp.

## ◆ nssv_inline_ns

#define nssv_inline_ns /*inline*/

Definition at line 376 of file string_view.hpp.

## ◆ nssv_nodiscard

#define nssv_nodiscard /*[[nodiscard]]*/

Definition at line 402 of file string_view.hpp.

## ◆ nssv_noexcept

#define nssv_noexcept /*noexcept*/

Definition at line 382 of file string_view.hpp.

## ◆ nssv_nullptr

#define nssv_nullptr NULL

Definition at line 396 of file string_view.hpp.

## ◆ nssv_RESTORE_WARNINGS

#define nssv_RESTORE_WARNINGS | ( |  | ) |

Definition at line 450 of file string_view.hpp.

## ◆ nssv_STRING_VIEW_DEFAULT

#define nssv_STRING_VIEW_DEFAULT 0

Definition at line 25 of file string_view.hpp.

## ◆ nssv_STRING_VIEW_NONSTD

#define nssv_STRING_VIEW_NONSTD 1

Definition at line 26 of file string_view.hpp.

## ◆ nssv_STRING_VIEW_STD

#define nssv_STRING_VIEW_STD 2

Definition at line 27 of file string_view.hpp.

## ◆ nssv_STRINGIFY

#define nssv_STRINGIFY | ( |  | x | ) | nssv_STRINGIFY_( x )

Definition at line 20 of file string_view.hpp.

## ◆ nssv_STRINGIFY_

#define nssv_STRINGIFY_ | ( |  | x | ) | #x

Definition at line 21 of file string_view.hpp.

## ◆ nssv_SUPPRESS_MSGSL_WARNING

#define nssv_SUPPRESS_MSGSL_WARNING | ( |  | expr | ) |

Definition at line 438 of file string_view.hpp.

## ◆ nssv_SUPPRESS_MSVC_WARNING

#define nssv_SUPPRESS_MSVC_WARNING | ( |  | code,
|  |  | descr
| ) |  |

Definition at line 439 of file string_view.hpp.

## ◆ nssv_USES_STD_STRING_VIEW

#define nssv_USES_STD_STRING_VIEW ( (nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_STD) || ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_DEFAULT) && nssv_HAVE_STD_STRING_VIEW) )

Definition at line 112 of file string_view.hpp.

## ◆ string_view_lite_MAJOR

#define string_view_lite_MAJOR 1

Definition at line 14 of file string_view.hpp.

## ◆ string_view_lite_MINOR

#define string_view_lite_MINOR 6

Definition at line 15 of file string_view.hpp.

## ◆ string_view_lite_PATCH

#define string_view_lite_PATCH 0

Definition at line 16 of file string_view.hpp.

## ◆ string_view_lite_VERSION

#define string_view_lite_VERSION nssv_STRINGIFY(string_view_lite_MAJOR) "." nssv_STRINGIFY(string_view_lite_MINOR) "." nssv_STRINGIFY(string_view_lite_PATCH)

Definition at line 18 of file string_view.hpp.

## Function Documentation

## ◆ nssv_DISABLE_MSVC_WARNINGS()

nssv_DISABLE_MSVC_WARNINGS | ( | 4455 26481 | 26472 | ) |

Definition at line 460 of file string_view.hpp.