Skip to content

Commit

Permalink
Native support for std::span (#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenworld1 committed Feb 10, 2024
1 parent 1445b97 commit 5e22e58
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions include/pqxx/internal/conversions.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,37 @@ inline constexpr format param_format(std::vector<std::byte, Args...> const &)
template<typename T> inline constexpr bool is_sql_array<std::vector<T>>{true};


#if defined(PQXX_HAVE_SPAN) && __has_include(<span>)
template<typename T, size_t Extent>
struct nullness<std::span<T, Extent>> : no_null<std::span<T, Extent>>
{};


template<typename T, size_t Extent>
struct string_traits<std::span<T, Extent>>
: internal::array_string_traits<std::span<T, Extent>>
{};


template<typename T, size_t Extent>
inline constexpr format param_format(std::span<T, Extent> const &)
{
return format::text;
}


template<size_t Extent>
inline constexpr format param_format(std::span<std::byte, Extent> const &)
{
return format::binary;
}


template<typename T, size_t Extent>
inline constexpr bool is_sql_array<std::span<T, Extent>>{true};
#endif


template<typename T, std::size_t N>
struct nullness<std::array<T, N>> : no_null<std::array<T, N>>
{};
Expand Down

0 comments on commit 5e22e58

Please sign in to comment.