Skip to content

Commit 2865dcb

Browse files
committed
API change
1 parent acd41a9 commit 2865dcb

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

include/proxy/v4/proxy.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,14 @@ using merge_facade_conv_t = typename add_substitution_conv<
20172017
? F::relocatability
20182018
: constraint_level::none>::type;
20192019

2020+
template <bool WithSubstitution>
2021+
struct add_facade_deprecation_traits : std::bool_constant<WithSubstitution> {};
2022+
template <>
2023+
struct [[deprecated(
2024+
"basic_facade_builder::add_facade<F, true> is deprecated; use "
2025+
"basic_facade_builder::add_facade_with_substitution<F> instead.")]]
2026+
add_facade_deprecation_traits<true> : std::bool_constant<true> {};
2027+
20202028
} // namespace details
20212029

20222030
template <class Cs, class Rs, std::size_t MaxSize, std::size_t MaxAlign,
@@ -2048,7 +2056,18 @@ struct basic_facade_builder {
20482056
using add_reflection = add_indirect_reflection<R>;
20492057
template <facade F, bool WithSubstitution = false>
20502058
using add_facade = basic_facade_builder<
2051-
details::merge_facade_conv_t<Cs, F, WithSubstitution>,
2059+
details::merge_facade_conv_t<
2060+
Cs, F,
2061+
details::add_facade_deprecation_traits<WithSubstitution>::value>,
2062+
details::merge_tuple_t<Rs, typename F::reflection_types>,
2063+
details::merge_size(MaxSize, F::max_size),
2064+
details::merge_size(MaxAlign, F::max_align),
2065+
details::merge_constraint(Copyability, F::copyability),
2066+
details::merge_constraint(Relocatability, F::relocatability),
2067+
details::merge_constraint(Destructibility, F::destructibility)>;
2068+
template <facade F>
2069+
using add_facade_with_substitution = basic_facade_builder<
2070+
details::merge_facade_conv_t<Cs, F, true>,
20522071
details::merge_tuple_t<Rs, typename F::reflection_types>,
20532072
details::merge_size(MaxSize, F::max_size),
20542073
details::merge_size(MaxAlign, F::max_align),

tests/proxy_creation_tests.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@ struct TestSharedStringable
167167
::add_direct_reflection<LifetimeModelReflector> //
168168
::build {};
169169

170-
struct TestWeakSharedStringable : pro::facade_builder //
171-
::add_facade<TestSharedStringable, true> //
172-
::add_skill<pro::skills::as_weak> //
173-
::build {};
170+
struct TestWeakSharedStringable
171+
: pro::facade_builder //
172+
::add_facade_with_substitution<TestSharedStringable> //
173+
::add_skill<pro::skills::as_weak> //
174+
::build {};
174175

175176
static_assert(pro::proxiable<int*, TestSharedStringable>);
176177
static_assert(!pro::proxiable<int*, TestWeakSharedStringable>);

tests/proxy_lifetime_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct TestTrivialFacade
2828

2929
struct TestRttiFacade : pro::facade_builder //
3030
::add_direct_reflection<utils::RttiReflector> //
31-
::add_facade<TestFacade, true> //
31+
::add_facade_with_substitution<TestFacade> //
3232
::build {};
3333

3434
// Additional static asserts for substitution

tests/proxy_view_tests.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ TEST(ProxyViewTests, TestOverloadShadowing) {
139139

140140
TEST(ProxyViewTests, TestSubstitution_FromNull) {
141141
struct TestFacade1 : pro::facade_builder::build {};
142-
struct TestFacade2 : pro::facade_builder //
143-
::add_facade<TestFacade1, true> // Supports substitution
144-
::add_skill<pro::skills::as_view> //
142+
struct TestFacade2 : pro::facade_builder //
143+
::add_facade_with_substitution<TestFacade1> //
144+
::add_skill<pro::skills::as_view> //
145145
::build {};
146146
pro::proxy<TestFacade2> p1;
147147
pro::proxy_view<TestFacade2> p2 = p1;
@@ -158,8 +158,8 @@ TEST(ProxyViewTests, TestSubstitution_FromValue) {
158158
::build {};
159159
struct TestFacade2 : pro::facade_builder //
160160
::support_copy<pro::constraint_level::nontrivial> //
161-
::add_facade<TestFacade1, true> // Supports substitution
162-
::add_skill<pro::skills::as_view> //
161+
::add_facade_with_substitution<TestFacade1> //
162+
::add_skill<pro::skills::as_view> //
163163
::build {};
164164
pro::proxy<TestFacade2> p1 = pro::make_proxy<TestFacade2>(123);
165165
pro::proxy_view<TestFacade2> p2 = p1;

0 commit comments

Comments
 (0)