// // Copyright (c) 2019-2024 Ruben Perez Hidalgo (rubenperez038 at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_MYSQL_DETAIL_TYPING_ROW_TRAITS_HPP #define BOOST_MYSQL_DETAIL_TYPING_ROW_TRAITS_HPP #include #ifdef BOOST_MYSQL_CXX14 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace mysql { namespace detail { // // Base templates. Every StaticRow type must specialize the row_traits class, // providing the following members: // // // type of the actual row to be parsed. This supports marker types, like pfr_by_name // using underlying_row_type = /* */; // // // MP11 type list with the row's member types // using field_types = /* */; // // static constexpr name_table_t name_table() noexcept; // field names // // template /* Apply F to each member */ // static void for_each_member(underlying_row_t& to, F&& function); // // struct row_traits_is_unspecialized { }; template ::value> class row_traits : public row_traits_is_unspecialized { }; // // Describe structs // // Workaround std::array::data not being constexpr in C++14 template struct array_wrapper { T data_[N]; constexpr boost::span span() const noexcept { return boost::span(data_); } }; template struct array_wrapper { struct { } data_; // allow empty brace initialization constexpr boost::span span() const noexcept { return boost::span(); } }; // Workaround for char_traits::length not being constexpr in C++14 // Only used to retrieve Describe member name lengths constexpr std::size_t get_length(const char* s) noexcept { const char* p = s; while (*p) ++p; return p - s; } template using row_members = describe:: describe_members; template