libpqxx
The C++ client library for PostgreSQL
Loading...
Searching...
No Matches
pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE > Struct Template Reference

Deliberately nonfunctional conversion traits for char types. More...

Static Public Member Functions

static char * into_buf (char *, char *, CHAR_TYPE)=delete
static constexpr zview to_buf (char *, char *, CHAR_TYPE const &) noexcept=delete
static constexpr std::size_t size_buffer (CHAR_TYPE const &) noexcept=delete
static CHAR_TYPE from_string (std::string_view)=delete

Static Public Attributes

static constexpr bool converts_to_string {false}
static constexpr bool converts_from_string {false}

Detailed Description

template<typename CHAR_TYPE>
struct pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >

Deliberately nonfunctional conversion traits for char types.

There are no string conversions for char and its signed and unsigned variants. Such a conversion would be dangerously ambiguous: should we treat it as text, or as a small integer? It'd be an open invitation for bugs.

But the error message when you get this wrong is very cryptic. So, we derive dummy string_traits implementations from this dummy type, and ensure that the compiler disallows their use. The compiler error message will at least contain a hint of the root of the problem.

Member Function Documentation

◆ from_string()

template<typename CHAR_TYPE>
CHAR_TYPE pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >::from_string ( std::string_view )
staticdelete

◆ into_buf()

template<typename CHAR_TYPE>
char * pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >::into_buf ( char * ,
char * ,
CHAR_TYPE  )
staticdelete

◆ size_buffer()

template<typename CHAR_TYPE>
constexpr std::size_t pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >::size_buffer ( CHAR_TYPE const & )
staticconstexprdeletenoexcept

◆ to_buf()

template<typename CHAR_TYPE>
constexpr zview pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >::to_buf ( char * ,
char * ,
CHAR_TYPE const &  )
staticconstexprdeletenoexcept

Member Data Documentation

◆ converts_from_string

template<typename CHAR_TYPE>
bool pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >::converts_from_string {false}
staticconstexpr

◆ converts_to_string

template<typename CHAR_TYPE>
bool pqxx::internal::disallowed_ambiguous_char_conversion< CHAR_TYPE >::converts_to_string {false}
staticconstexpr

The documentation for this struct was generated from the following file:
  • /builddir/build/BUILD/libpqxx-7.10.5-build/libpqxx-7.10.5/redhat-linux-build/include/pqxx/internal/conversions.hxx