|
libpqxx
The C++ client library for PostgreSQL
|
Nullness traits describing a type which does not have a null value. More...
Static Public Member Functions | |
| static constexpr bool | is_null (TYPE const &) noexcept |
| Does a given value correspond to an SQL null value? | |
Static Public Attributes | |
| static constexpr bool | has_null = false |
Does TYPE have a "built-in null value"? | |
| static constexpr bool | always_null = false |
| Are all values of this type null? | |
Nullness traits describing a type which does not have a null value.
|
inlinestaticconstexprnoexcept |
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."