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.


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