Skip to content

Commit 1e5520b

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
rename to function_traits::result
Reviewed By: dmm-fb Differential Revision: D74496167 fbshipit-source-id: 952709fb20a6d523becd509a7f3bb6b6e5946525
1 parent b6fa1d8 commit 1e5520b

File tree

4 files changed

+57
-60
lines changed

4 files changed

+57
-60
lines changed

folly/channels/detail/MultiplexerTraits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct MultiplexerTraits {
5050

5151
// Element type of the returned vector from MultiplexerType::onNewSubscription
5252
using OutputValueType =
53-
typename OnNewSubscriptionTraits::result_type::StorageType::value_type;
53+
typename OnNewSubscriptionTraits::result::StorageType::value_type;
5454
};
5555
} // namespace detail
5656
} // namespace channels

folly/functional/protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ template <typename S>
108108
struct match_safely_invocable_as_protocol_impl_ {
109109
using traits = function_traits<S>;
110110

111-
using sig_r = typename traits::result_type;
111+
using sig_r = typename traits::result;
112112
static constexpr bool sig_nx = traits::is_nothrow;
113113

114114
template <typename F>

folly/functional/test/traits_test.cpp

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ struct TraitsTest : testing::Test {
2626
using traits = folly::function_traits<S>;
2727

2828
template <typename S>
29-
using result_type_t = typename traits<S>::result_type;
29+
using result_t = typename traits<S>::result;
3030

3131
template <typename R, typename S>
32-
static constexpr bool is_result_type_v =
33-
std::is_same<R, result_type_t<S>>::value;
32+
static constexpr bool is_result_v = std::is_same<R, result_t<S>>::value;
3433

3534
template <typename S>
3635
static constexpr bool is_nothrow_v = traits<S>::is_nothrow;
@@ -68,54 +67,54 @@ TEST_F(TraitsTest, function_traits) {
6867

6968
// result_type
7069

71-
EXPECT_TRUE((is_result_type_v<vc, vc()>));
72-
EXPECT_TRUE((is_result_type_v<vc, vc() const>));
73-
EXPECT_TRUE((is_result_type_v<vc, vc() volatile>));
74-
EXPECT_TRUE((is_result_type_v<vc, vc() const volatile>));
75-
EXPECT_TRUE((is_result_type_v<vc, vc()&>));
76-
EXPECT_TRUE((is_result_type_v<vc, vc() const&>));
77-
EXPECT_TRUE((is_result_type_v<vc, vc() volatile&>));
78-
EXPECT_TRUE((is_result_type_v<vc, vc() const volatile&>));
79-
EXPECT_TRUE((is_result_type_v<vc, vc() &&>));
80-
EXPECT_TRUE((is_result_type_v<vc, vc() const&&>));
81-
EXPECT_TRUE((is_result_type_v<vc, vc() volatile&&>));
82-
EXPECT_TRUE((is_result_type_v<vc, vc() const volatile&&>));
83-
EXPECT_TRUE((is_result_type_v<vc, vc(...)>));
84-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const>));
85-
EXPECT_TRUE((is_result_type_v<vc, vc(...) volatile>));
86-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const volatile>));
87-
EXPECT_TRUE((is_result_type_v<vc, vc(...)&>));
88-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const&>));
89-
EXPECT_TRUE((is_result_type_v<vc, vc(...) volatile&>));
90-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const volatile&>));
91-
EXPECT_TRUE((is_result_type_v<vc, vc(...) &&>));
92-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const&&>));
93-
EXPECT_TRUE((is_result_type_v<vc, vc(...) volatile&&>));
94-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const volatile&&>));
95-
EXPECT_TRUE((is_result_type_v<vc, vc() noexcept>));
96-
EXPECT_TRUE((is_result_type_v<vc, vc() const noexcept>));
97-
EXPECT_TRUE((is_result_type_v<vc, vc() volatile noexcept>));
98-
EXPECT_TRUE((is_result_type_v<vc, vc() const volatile noexcept>));
99-
EXPECT_TRUE((is_result_type_v<vc, vc() & noexcept>));
100-
EXPECT_TRUE((is_result_type_v<vc, vc() const & noexcept>));
101-
EXPECT_TRUE((is_result_type_v<vc, vc() volatile & noexcept>));
102-
EXPECT_TRUE((is_result_type_v<vc, vc() const volatile & noexcept>));
103-
EXPECT_TRUE((is_result_type_v < vc, vc() && noexcept >));
104-
EXPECT_TRUE((is_result_type_v < vc, vc() const&& noexcept >));
105-
EXPECT_TRUE((is_result_type_v < vc, vc() volatile && noexcept >));
106-
EXPECT_TRUE((is_result_type_v < vc, vc() const volatile&& noexcept >));
107-
EXPECT_TRUE((is_result_type_v<vc, vc(...) noexcept>));
108-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const noexcept>));
109-
EXPECT_TRUE((is_result_type_v<vc, vc(...) volatile noexcept>));
110-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const volatile noexcept>));
111-
EXPECT_TRUE((is_result_type_v<vc, vc(...) & noexcept>));
112-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const & noexcept>));
113-
EXPECT_TRUE((is_result_type_v<vc, vc(...) volatile & noexcept>));
114-
EXPECT_TRUE((is_result_type_v<vc, vc(...) const volatile & noexcept>));
115-
EXPECT_TRUE((is_result_type_v < vc, vc(...) && noexcept >));
116-
EXPECT_TRUE((is_result_type_v < vc, vc(...) const&& noexcept >));
117-
EXPECT_TRUE((is_result_type_v < vc, vc(...) volatile && noexcept >));
118-
EXPECT_TRUE((is_result_type_v < vc, vc(...) const volatile&& noexcept >));
70+
EXPECT_TRUE((is_result_v<vc, vc()>));
71+
EXPECT_TRUE((is_result_v<vc, vc() const>));
72+
EXPECT_TRUE((is_result_v<vc, vc() volatile>));
73+
EXPECT_TRUE((is_result_v<vc, vc() const volatile>));
74+
EXPECT_TRUE((is_result_v<vc, vc()&>));
75+
EXPECT_TRUE((is_result_v<vc, vc() const&>));
76+
EXPECT_TRUE((is_result_v<vc, vc() volatile&>));
77+
EXPECT_TRUE((is_result_v<vc, vc() const volatile&>));
78+
EXPECT_TRUE((is_result_v<vc, vc() &&>));
79+
EXPECT_TRUE((is_result_v<vc, vc() const&&>));
80+
EXPECT_TRUE((is_result_v<vc, vc() volatile&&>));
81+
EXPECT_TRUE((is_result_v<vc, vc() const volatile&&>));
82+
EXPECT_TRUE((is_result_v<vc, vc(...)>));
83+
EXPECT_TRUE((is_result_v<vc, vc(...) const>));
84+
EXPECT_TRUE((is_result_v<vc, vc(...) volatile>));
85+
EXPECT_TRUE((is_result_v<vc, vc(...) const volatile>));
86+
EXPECT_TRUE((is_result_v<vc, vc(...)&>));
87+
EXPECT_TRUE((is_result_v<vc, vc(...) const&>));
88+
EXPECT_TRUE((is_result_v<vc, vc(...) volatile&>));
89+
EXPECT_TRUE((is_result_v<vc, vc(...) const volatile&>));
90+
EXPECT_TRUE((is_result_v<vc, vc(...) &&>));
91+
EXPECT_TRUE((is_result_v<vc, vc(...) const&&>));
92+
EXPECT_TRUE((is_result_v<vc, vc(...) volatile&&>));
93+
EXPECT_TRUE((is_result_v<vc, vc(...) const volatile&&>));
94+
EXPECT_TRUE((is_result_v<vc, vc() noexcept>));
95+
EXPECT_TRUE((is_result_v<vc, vc() const noexcept>));
96+
EXPECT_TRUE((is_result_v<vc, vc() volatile noexcept>));
97+
EXPECT_TRUE((is_result_v<vc, vc() const volatile noexcept>));
98+
EXPECT_TRUE((is_result_v<vc, vc() & noexcept>));
99+
EXPECT_TRUE((is_result_v<vc, vc() const & noexcept>));
100+
EXPECT_TRUE((is_result_v<vc, vc() volatile & noexcept>));
101+
EXPECT_TRUE((is_result_v<vc, vc() const volatile & noexcept>));
102+
EXPECT_TRUE((is_result_v < vc, vc() && noexcept >));
103+
EXPECT_TRUE((is_result_v < vc, vc() const&& noexcept >));
104+
EXPECT_TRUE((is_result_v < vc, vc() volatile && noexcept >));
105+
EXPECT_TRUE((is_result_v < vc, vc() const volatile&& noexcept >));
106+
EXPECT_TRUE((is_result_v<vc, vc(...) noexcept>));
107+
EXPECT_TRUE((is_result_v<vc, vc(...) const noexcept>));
108+
EXPECT_TRUE((is_result_v<vc, vc(...) volatile noexcept>));
109+
EXPECT_TRUE((is_result_v<vc, vc(...) const volatile noexcept>));
110+
EXPECT_TRUE((is_result_v<vc, vc(...) & noexcept>));
111+
EXPECT_TRUE((is_result_v<vc, vc(...) const & noexcept>));
112+
EXPECT_TRUE((is_result_v<vc, vc(...) volatile & noexcept>));
113+
EXPECT_TRUE((is_result_v<vc, vc(...) const volatile & noexcept>));
114+
EXPECT_TRUE((is_result_v < vc, vc(...) && noexcept >));
115+
EXPECT_TRUE((is_result_v < vc, vc(...) const&& noexcept >));
116+
EXPECT_TRUE((is_result_v < vc, vc(...) volatile && noexcept >));
117+
EXPECT_TRUE((is_result_v < vc, vc(...) const volatile&& noexcept >));
119118

120119
// is_nothrow
121120

folly/functional/traits.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct function_traits_base_;
2727

2828
template <typename R, typename... A>
2929
struct function_traits_base_<R(A...)> {
30-
using result_type = R;
30+
using result = R;
3131

3232
template <std::size_t Idx>
3333
using argument = type_pack_element_t<Idx, A...>;
@@ -64,7 +64,7 @@ struct function_traits_cvref_ {
6464
// When complete, has a class body of the form:
6565
//
6666
// struct function_traits<S> {
67-
// using result_type = R;
67+
// using result = R;
6868
// static constexpr bool is_nothrow = NX;
6969
//
7070
// template <std::size_t Index>
@@ -475,11 +475,9 @@ struct function_remove_cvref_<true, true, R> {
475475
};
476476

477477
template <typename F, typename T = function_traits<F>>
478-
using function_remove_cvref_t_ =
479-
typename T::template arguments<function_remove_cvref_<
480-
T::is_nothrow,
481-
T::is_variadic,
482-
typename T::result_type>::template apply>;
478+
using function_remove_cvref_t_ = typename T::template arguments<
479+
function_remove_cvref_<T::is_nothrow, T::is_variadic, typename T::result>::
480+
template apply>;
483481

484482
} // namespace detail
485483

0 commit comments

Comments
 (0)