openMSX
Classes | Functions
static_string_view.hh File Reference
#include "StringStorage.hh"
#include <cassert>
#include <cstring>
#include <string_view>
#include <utility>
Include dependency graph for static_string_view.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  static_string_view
 static_string_view More...
 
struct  static_string_view::lifetime_ok_tag
 

Functions

auto make_string_storage (std::string_view sv)
 Take a string_view, make a copy of it, and return a pair of. More...
 

Function Documentation

◆ make_string_storage()

auto make_string_storage ( std::string_view  sv)
inline

Take a string_view, make a copy of it, and return a pair of.

  • Storage for the copy.
  • A static_string_view object pointing to that storage. The view only remains valid for as long as the storage is kept alive.

Note: using a std::string for the string-storage is not correct when that std::string object can be moved. This implementation is correct even when the storage-handler object gets moved.

Definition at line 63 of file static_string_view.hh.

References allocate_string_storage(), and utf8::unchecked::size().

Referenced by TEST_CASE().