Essentially alias for a C++17-conforming string-view class template, which is a very lightweight std::string-like representation of a character sequence already in memory.  
 More...
Inherits std::basic_string_view< Char >.
|  | 
| constexpr | Basic_string_view () noexcept | 
|  | Constructs null view: identical to Base API. 
 | 
|  | 
| constexpr | Basic_string_view (Ch const *s, size_t count) | 
|  | Constructs view to string at given start location and length: identical to Base API.  More... 
 | 
|  | 
| constexpr | Basic_string_view (Ch const *s) | 
|  | Constructs view to given NUL-terminated string: identical to Base API.  More... 
 | 
|  | 
| constexpr | Basic_string_view (const Basic_string_view &s) noexcept | 
|  | Boring copy constructor: identical to Base API.  More... 
 | 
|  | 
| constexpr | Basic_string_view (Base s) | 
|  | Identical to copy constructor but converts from a vanilla Base.  More... 
 | 
|  | 
|  | Basic_string_view (const std::basic_string< Ch, Traits > &s) | 
|  | Constructs view directly into a std::basic_string(e.g.,std::string).  More...
 | 
|  | 
| constexpr Basic_string_view & | operator= (const Basic_string_view &s) noexcept | 
|  | Boring copy assignment: identical to Base API.  More... 
 | 
|  | 
| bool | starts_with (Basic_string_view needle) const | 
|  | Equivalent to C++20 basic_string_view::starts_with()which is lacking in C++17 but present in C++20 and previously-used-in-Flow Boost equivalentstring_view.  More...
 | 
|  | 
| bool | starts_with (Ch const *needle) const | 
|  | Equivalent to C++20 basic_string_view::starts_with()which is lacking in C++17 but present in C++20 and previously-used-in-Flow Boost equivalentstring_view.  More...
 | 
|  | 
| bool | starts_with (Ch needle) const | 
|  | Equivalent to C++20 basic_string_view::starts_with()which is lacking in C++17 but present in C++20 and previously-used-in-Flow Boost equivalentstring_view.  More...
 | 
|  | 
| bool | ends_with (Basic_string_view needle) const | 
|  | Equivalent to C++20 basic_string_view::ends_with()which is lacking in C++17 but present in C++20 and previously-used-in-Flow Boost equivalentstring_view.  More...
 | 
|  | 
| bool | ends_with (Ch const *needle) const | 
|  | Equivalent to C++20 basic_string_view::ends_with()which is lacking in C++17 but present in C++20 and previously-used-in-Flow Boost equivalentstring_view.  More...
 | 
|  | 
| bool | ends_with (Ch needle) const | 
|  | Equivalent to C++20 basic_string_view::ends_with()which is lacking in C++17 but present in C++20 and previously-used-in-Flow Boost equivalentstring_view.  More...
 | 
|  | 
template<typename Ch, typename Traits = std::char_traits<Ch>>
class flow::util::Basic_string_view< Ch, Traits >
Essentially alias for a C++17-conforming string-view class template, which is a very lightweight std::string-like representation of a character sequence already in memory. 
As of March 2022 the alias is formally to std::basic_string_view (unlike in the past, when that was not available – until C++17). However the alias remains to, at least, avoid breaking user code – by providing the String_view related alias. In addition this API-only subclass adds starts_with() and ends_with() which implement the common-sense C++20 basic_string_view operations starts_with() and ends_width(). These existed in the Boost basic_string_view that, pre-C++17, used to be the String_view alias target (when Ch is char). The downgrade due to their lack of inclusion in C++17 (which inaugurated *string_view in C++ STL) is unfortunate; but these replacements are fine.
- See also
- String_view, which is to std::string_viewwhat the present template is tostd::basic_string_view. I.e., when working withcharstring sequences, which is typical, use String_view.
Rationale
Why is this even a thing? Why not use std::basic_string_view and std::string_view all over? Answer: It is mostly historic. Flow was C++14 until ~3/2022. std::string_view was added in C++17. Before then, String_view aliased to boost::string_view (another possibility would have been boost::string_ref – same API – long story), because it was available for C++14. Now that we're on C++17, it's better to use the std thing, especially since many STL (and Boost, nowadays) APIs take std::string_view directly. Hence the alias changed as planned all along.
However the type alias remains. Pragmatically: much code uses String_view, even outside Flow, and there's no harm in an alias, particularly since we add the nice starts_with() and ends_with(). The alias was actively useful before; now removing it is a breaking change.
Implementation/API note
It would have been ideal to define the various constructors by simply inheriting all of std::basic_string_view ctors via the single statement using Base::Base. However, at least with our gcc, it appears to cause some issue in propagating constexprness of these constructors (which is effectively used, at least, by the flow::log macros to make certain optimizations possible): compile errors. To avoid this and various conversion issues, a number of constructors are explicitly (re)defined.