mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-22 17:32:35 +00:00
Compare commits
2 Commits
2.2.0
...
boost-1.84
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98789f610a | ||
|
|
c695aa0b32 |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -145,6 +145,10 @@ jobs:
|
||||
addrmd: 64
|
||||
os: windows-2022
|
||||
threads: "-j1"
|
||||
- toolset: clang-win
|
||||
cxxstd: "14,17,2a,latest"
|
||||
addrmd: 32,64
|
||||
os: windows-2022
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
|
||||
@@ -109,6 +109,8 @@ void test_examples() {
|
||||
// Disabled from testing since it's unportable
|
||||
#if 0
|
||||
{
|
||||
// Keep in mind that it's unportable code
|
||||
// You should move this structure somewhere outside of function scope
|
||||
//[pfr_quick_examples_get_name
|
||||
// Get name of field by index
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
|
||||
|
||||
#ifndef BOOST_PFR_CORE_NAME_PARSING
|
||||
# if defined(_MSC_VER)
|
||||
# if defined(_MSC_VER) && !defined(__clang__)
|
||||
# define BOOST_PFR_CORE_NAME_PARSING (sizeof("auto __cdecl boost::pfr::detail::name_of_field_impl<") - 1, sizeof(">(void) noexcept") - 1, backward("->"))
|
||||
# elif defined(__clang__)
|
||||
# define BOOST_PFR_CORE_NAME_PARSING (sizeof("auto boost::pfr::detail::name_of_field_impl() [MsvcWorkaround = ") - 1, sizeof("}]") - 1, backward("."))
|
||||
|
||||
@@ -167,7 +167,7 @@ consteval auto name_of_field() noexcept {
|
||||
&& std::string_view{
|
||||
detail::name_of_field_impl<
|
||||
core_name_skip, detail::make_clang_wrapper(std::addressof(
|
||||
fake_object<core_name_skip>.size_at_begin
|
||||
detail::fake_object<core_name_skip>().size_at_begin
|
||||
))
|
||||
>().data()
|
||||
} == "size_at_begin",
|
||||
@@ -187,7 +187,7 @@ consteval auto name_of_field() noexcept {
|
||||
template <class T, std::size_t I>
|
||||
inline constexpr auto stored_name_of_field = detail::name_of_field<T,
|
||||
detail::make_clang_wrapper(std::addressof(detail::sequence_tuple::get<I>(
|
||||
detail::tie_as_tuple(detail::fake_object<T>)
|
||||
detail::tie_as_tuple(detail::fake_object<T>())
|
||||
)))
|
||||
>();
|
||||
|
||||
|
||||
@@ -16,8 +16,19 @@
|
||||
|
||||
namespace boost { namespace pfr { namespace detail {
|
||||
|
||||
// This variable serves as a compile-time assert. If you see any error here, then
|
||||
// you're probably using `boost::pfr::get_name()` or `boost::pfr::names_as_array()` with a non-external linkage type.
|
||||
template <class T>
|
||||
extern const T fake_object;
|
||||
extern const T passed_type_has_no_external_linkage;
|
||||
|
||||
// For returning non default constructible types, it's exclusively used in member name retrieval.
|
||||
//
|
||||
// Neither std::declval nor boost::pfr::detail::unsafe_declval are usable there.
|
||||
// Limitation - T should have external linkage.
|
||||
template <class T>
|
||||
constexpr const T& fake_object() noexcept {
|
||||
return passed_type_has_no_external_linkage<T>;
|
||||
}
|
||||
|
||||
}}} // namespace boost::pfr::detail
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace boost::pfr;
|
||||
template <class T, std::size_t I>
|
||||
inline constexpr auto no_check_stored_name_of_field = detail::name_of_field_impl<T,
|
||||
detail::make_clang_wrapper(std::addressof(detail::sequence_tuple::get<I>(
|
||||
detail::tie_as_tuple(detail::fake_object<T>)
|
||||
detail::tie_as_tuple(detail::fake_object<T>())
|
||||
)))
|
||||
>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user