Coverage Report

Created: 2026-02-09 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Utilities/std/cmext/string_view
Line
Count
Source
1
// -*-c++-*-
2
// vim: set ft=cpp:
3
4
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
5
   file LICENSE.rst or https://cmake.org/licensing for details.  */
6
#pragma once
7
8
#include <cstddef>
9
10
#include <cm/string_view>
11
12
namespace cm {
13
14
/** A string_view that only binds to static storage.
15
 *
16
 * This is used together with the `""_s` user-defined literal operator
17
 * to construct a type-safe abstraction of a string_view that only views
18
 * statically allocated strings.  These strings are const and available
19
 * for the entire lifetime of the program.
20
 */
21
class static_string_view : public string_view
22
{
23
  static_string_view(string_view v)
24
    : string_view(v)
25
0
  {
26
0
  }
27
28
  friend static_string_view operator"" _s(char const* data, size_t size);
29
};
30
31
/** Create a static_string_view using `""_s` literal syntax.  */
32
inline static_string_view operator"" _s(char const* data, size_t size)
33
0
{
34
0
  return string_view(data, size);
35
0
}
36
37
} // namespace cm
38
39
using cm::operator"" _s;