libpqxx  7.1.0
pqxx::zview Class Reference

Marker-type wrapper: zero-terminated std::string_view. More...

#include <zview.hxx>

Inheritance diagram for pqxx::zview:

Public Member Functions

constexpr zview () noexcept=default
 
constexpr zview (const char text[], std::ptrdiff_t len)
 Convenience overload: construct using pointer and signed length. More...
 
constexpr zview (char text[], std::ptrdiff_t len)
 Convenience overload: construct using pointer and signed length. More...
 
template<typename... Args>
constexpr zview (Args &&... args)
 
constexpr char const * c_str () const noexcept
 Either a null pointer, or a zero-terminated text buffer. More...
 

Detailed Description

Marker-type wrapper: zero-terminated std::string_view.

Warning
Use this only if the underlying string is zero-terminated.

When you construct a zview, you are promising that the underlying string is zero-terminated. It otherwise behaves exactly like a std::string_view. The terminating zero is not "in" the string, so it does not count as part of the view's length.

The added guarantee lets the view be used as a C-style string, which often matters since libpqxx builds on top of a C library. For this reason, zview also adds a c_str method.

Constructor & Destructor Documentation

◆ zview() [1/4]

constexpr pqxx::zview::zview ( )
defaultnoexcept

◆ zview() [2/4]

constexpr pqxx::zview::zview ( const char  text[],
std::ptrdiff_t  len 
)

Convenience overload: construct using pointer and signed length.

◆ zview() [3/4]

constexpr pqxx::zview::zview ( char  text[],
std::ptrdiff_t  len 
)

Convenience overload: construct using pointer and signed length.

◆ zview() [4/4]

template<typename... Args>
constexpr pqxx::zview::zview ( Args &&...  args)
explicit

Member Function Documentation

◆ c_str()

constexpr char const* pqxx::zview::c_str ( ) const
noexcept

The documentation for this class was generated from the following file: