Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions include/rfl/field_names_t.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef RFL_FIELD_NAMES_T_HPP_
#define RFL_FIELD_NAMES_T_HPP_

#include <functional>
#include <type_traits>

#include "internal/get_field_names.hpp"
Expand All @@ -13,8 +12,8 @@ namespace rfl {
/// for iteration, validation, or other metaprogramming tasks.
/// @tparam T The struct type to extract field names from
template <class T>
using field_names_t = typename std::invoke_result<
decltype(internal::get_field_names<std::remove_cvref_t<T>>)>::type;
using field_names_t =
decltype(internal::get_field_names<std::remove_cvref_t<T>>());

} // namespace rfl

Expand Down
4 changes: 2 additions & 2 deletions include/rfl/internal/Field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#define RFL_INTERNAL_FIELD_TUPLE_T_HPP_

#include <type_traits>
#include <utility>

#include "copy_to_field_tuple.hpp"

namespace rfl {
namespace internal {

template <class T>
using field_tuple_t =
typename std::invoke_result<decltype(copy_to_field_tuple<T>), T>::type;
using field_tuple_t = decltype(copy_to_field_tuple<T>(std::declval<T>()));

}
} // namespace rfl
Expand Down
8 changes: 4 additions & 4 deletions include/rfl/internal/cpp20/Result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class Result {
template <class F>
auto and_then(const F& _f) && {
/// Result_U is expected to be of type Result<U>.
using Result_U = typename std::invoke_result<F, T>::type;
using Result_U = decltype(_f(std::move(*this).get_t()));
if (success_) {
return Result_U(_f(std::move(*this).get_t()));
} else {
Expand All @@ -178,7 +178,7 @@ class Result {
template <class F>
auto and_then(const F& _f) const& {
/// Result_U is expected to be of type Result<U>.
using Result_U = typename std::invoke_result<F, T>::type;
using Result_U = decltype(_f(get_t()));
if (success_) {
return Result_U(_f(get_t()));
} else {
Expand Down Expand Up @@ -335,7 +335,7 @@ class Result {
template <class F>
RFL_ALWAYS_INLINE auto transform(const F& _f) && {
/// Result_U is expected to be of type Result<U>.
using U = decltype(std::declval<F>()(std::declval<T>()));
using U = decltype(_f(std::move(*this).get_t()));
if (success_) {
return Result<U>(_f(std::move(*this).get_t()));
} else {
Expand All @@ -355,7 +355,7 @@ class Result {
template <class F>
auto transform(const F& _f) const& {
/// Result_U is expected to be of type Result<U>.
using U = typename std::invoke_result<F, T>::type;
using U = decltype(_f(get_t()));
if (success_) {
return Result<U>(_f(get_t()));
} else {
Expand Down
4 changes: 2 additions & 2 deletions include/rfl/internal/field_tuple_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#define RFL_INTERNAL_FIELD_TUPLE_T_HPP_

#include <type_traits>
#include <utility>

#include "copy_to_field_tuple.hpp"

namespace rfl::internal {

template <class T>
using field_tuple_t =
typename std::invoke_result<decltype(copy_to_field_tuple<T>), T>::type;
using field_tuple_t = decltype(copy_to_field_tuple<T>(std::declval<T>()));

} // namespace rfl::internal

Expand Down
3 changes: 2 additions & 1 deletion include/rfl/internal/flattened_ptr_tuple_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define RFL_INTERNAL_FLATTENED_PTR_TUPLE_T_HPP_

#include <type_traits>
#include <utility>

#include "to_flattened_ptr_tuple.hpp"

Expand All @@ -10,7 +11,7 @@ namespace internal {

template <class T>
using flattened_ptr_tuple_t =
typename std::invoke_result<decltype(to_flattened_ptr_tuple<T>), T>::type;
decltype(to_flattened_ptr_tuple<T>(std::declval<T>()));

} // namespace internal
} // namespace rfl
Expand Down
4 changes: 2 additions & 2 deletions include/rfl/internal/move_from_named_tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define RFL_MOVE_FROM_NAMED_TUPLE_HPP_

#include <type_traits>
#include <utility>

#include "../Tuple.hpp"
#include "../named_tuple_t.hpp"
Expand All @@ -20,8 +21,7 @@ auto make_ptr_fields(PtrNamedTupleType& _n) {
using T = std::remove_cvref_t<std::remove_pointer_t<typename Field::Type>>;
if constexpr (is_named_tuple_v<T>) {
using SubPtrNamedTupleType =
typename std::invoke_result<decltype(nt_to_ptr_named_tuple<T>),
T>::type;
decltype(nt_to_ptr_named_tuple<T>(std::declval<T&>()));
return SubPtrNamedTupleType(_n).fields();
} else if constexpr (is_flatten_field<Field>::value) {
using SubPtrFieldTupleType = std::remove_cvref_t<ptr_field_tuple_t<T>>;
Expand Down
Loading