Skip to content

Commit

Permalink
-fixed issues with incomplete types;
Browse files Browse the repository at this point in the history
-fixed operator();
  • Loading branch information
kamchatka-volcano committed Jul 1, 2023
1 parent 58ec11d commit 887b606
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/sfun/member.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct member {
template<
typename V,
typename TCheck = T,
std::enable_if_t<!std::is_base_of_v<member<TCheck>, std::remove_reference_t<V>>>* = nullptr>
std::enable_if_t<!std::is_same_v<member<TCheck>, std::decay_t<V>>>* = nullptr>
constexpr member(V&& val)
: value_{detail::memberInit<T>(std::forward<V>(val))}
{
Expand Down Expand Up @@ -125,15 +125,15 @@ struct member {
std::enable_if_t<provides_array_element_access_v<CheckType> || std::is_pointer_v<CheckType>>* = nullptr>
constexpr auto& operator[](std::size_t index)
{
return value_[index];
return get()[index];
}

template<
typename CheckType = T,
std::enable_if_t<provides_array_element_access_v<CheckType> || std::is_pointer_v<CheckType>>* = nullptr>
constexpr const auto& operator[](std::size_t index) const
{
return value_[index];
return get()[index];
}

template<
Expand All @@ -142,7 +142,7 @@ struct member {
std::enable_if_t<std::is_invocable_v<CheckType, TArgs...>>* = nullptr>
constexpr decltype(auto) operator()(TArgs&&... args)
{
return value_(std::forward<TArgs>(args)...);
return get()(std::forward<TArgs>(args)...);
}

template<
Expand All @@ -151,7 +151,7 @@ struct member {
std::enable_if_t<std::is_invocable_v<CheckType, TArgs...>>* = nullptr>
constexpr decltype(auto) operator()(TArgs&&... args) const
{
return value_(std::forward<TArgs>(args)...);
return get()(std::forward<TArgs>(args)...);
}

template<typename V>
Expand Down

0 comments on commit 887b606

Please sign in to comment.