libpqxx  7.0.3
zview.hxx
1 /* Zero-terminated string view.
2  *
3  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/stringconv instead.
4  *
5  * Copyright (c) 2000-2020, Jeroen T. Vermeulen.
6  *
7  * See COPYING for copyright license. If you did not receive a file called
8  * COPYING with this source code, please notify the distributor of this
9  * mistake, or contact the author.
10  */
11 #ifndef PQXX_H_ZVIEW
12 #define PQXX_H_ZVIEW
13 
14 #include "pqxx/compiler-public.hxx"
15 
16 #include <string_view>
17 
18 namespace pqxx
19 {
21 
32 class zview : public std::string_view
33 {
34 public:
35  template<typename... Args>
36  explicit constexpr zview(Args &&... args) :
37  std::string_view(std::forward<Args>(args)...)
38  {}
39 
41  [[nodiscard]] constexpr char const *c_str() const noexcept { return data(); }
42 };
43 } // namespace pqxx
44 
45 #endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25
constexpr char const * c_str() const noexcept
Either a null pointer, or a zero-terminated text buffer.
Definition: zview.hxx:41
STL namespace.
constexpr zview(Args &&... args)
Definition: zview.hxx:36
Marker-type wrapper: zero-terminated std::string_view.
Definition: zview.hxx:32