stdarray.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) 2023 Denis Mikhailov
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PFR_DETAIL_STDARRAY_HPP
  6. #define BOOST_PFR_DETAIL_STDARRAY_HPP
  7. #pragma once
  8. #include <boost/pfr/detail/config.hpp>
  9. #include <boost/pfr/detail/sequence_tuple.hpp>
  10. #if !defined(BOOST_PFR_INTERFACE_UNIT)
  11. #include <array>
  12. #if BOOST_PFR_CORE_NAME_ENABLED
  13. # include <string_view>
  14. #endif
  15. #include <utility> // metaprogramming stuff
  16. #endif
  17. namespace boost { namespace pfr { namespace detail {
  18. #if BOOST_PFR_CORE_NAME_ENABLED
  19. template <class T, std::size_t... I>
  20. constexpr auto make_stdarray_from_tietuple(const T& t, std::index_sequence<I...>) noexcept {
  21. return std::array<std::string_view, sizeof...(I)>{
  22. boost::pfr::detail::sequence_tuple::get<I>(t)...
  23. };
  24. }
  25. #else
  26. template <class T, std::size_t... I>
  27. constexpr auto make_stdarray_from_tietuple(const T&, std::index_sequence<I...>) noexcept {
  28. return nullptr;
  29. }
  30. #endif
  31. }}} // namespace boost::pfr::detail
  32. #endif // BOOST_PFR_DETAIL_STDARRAY_HPP