libpqxx
7.9.0
|
Nullness traits describing a type which does not have a null value. More...
#include <strconv.hxx>
Static Public Member Functions | |
static constexpr bool | is_null (TYPE const &) noexcept |
Does a given value correspond to an SQL null value? More... | |
Static Public Attributes | |
static constexpr bool | has_null = false |
Does TYPE have a "built-in null value"? More... | |
static constexpr bool | always_null = false |
Are all values of this type null? More... | |
Nullness traits describing a type which does not have a null value.
|
staticconstexprnoexcept |
Does a given value correspond to an SQL null value?
Most C++ types, such as int
or std::string
, have no inherent null value. But some types such as C-style string pointers do have a natural equivalent to an SQL null.
|
staticconstexpr |
Are all values of this type null?
There are a few special C++ types which are always null - mainly std::nullptr_t
.
|
staticconstexpr |
Does TYPE
have a "built-in null value"?
For example, a pointer can equal nullptr
, which makes a very natural representation of an SQL null value. For such types, the code sometimes needs to make special allowances.
for most types, such as int
or std::string
, there is no built-in null. If you want to represent an SQL null value for such a type, you would have to wrap it in something that does have a null value. For example, you could use std::optional<int>
for "either an @c int or a
null value."