Skip to content

One member aggregate breaks fields_count #219

@12AT7

Description

@12AT7

There appears to be no matching assert_first_not_base for aggregates with exactly one member. This is what exists now in detail/fields_count.hpp:

template <class T, std::size_t I0, std::size_t... I, class /*Enable*/ = typename std::enable_if<!std::is_copy_constructible<T>::value>::type>
constexpr auto assert_first_not_base(std::index_sequence<I0, I...>) noexcept
    -> typename std::add_pointer<decltype(T{ ubiq_rref_base_asserting<T>{}, ubiq_rref_constructor{I}... })>::type
{
    return nullptr;
}

template <class T>
constexpr void* assert_first_not_base(std::index_sequence<>) noexcept
{
    return nullptr;
}

and I wonder if we also need:

template <class T>
constexpr auto assert_first_not_base(std::index_sequence<0UL>) noexcept
    -> typename std::add_pointer<decltype(T{ ubiq_rref_base_asserting<T>{}})>::type
{
    return nullptr;
}

to cover this case. In my situation, I hacked this in and it seems to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions