From 2865dcba8f9d49261181596a1740fc6fa57270b8 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Tue, 14 Apr 2026 22:39:58 +0800 Subject: [PATCH] API change --- include/proxy/v4/proxy.h | 21 ++++++++++++++++++++- tests/proxy_creation_tests.cpp | 9 +++++---- tests/proxy_lifetime_tests.cpp | 2 +- tests/proxy_view_tests.cpp | 10 +++++----- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index ae9903f..d5f5bd3 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -2017,6 +2017,14 @@ using merge_facade_conv_t = typename add_substitution_conv< ? F::relocatability : constraint_level::none>::type; +template +struct add_facade_deprecation_traits : std::bool_constant {}; +template <> +struct [[deprecated( + "basic_facade_builder::add_facade is deprecated; use " + "basic_facade_builder::add_facade_with_substitution instead.")]] +add_facade_deprecation_traits : std::bool_constant {}; + } // namespace details template ; template using add_facade = basic_facade_builder< - details::merge_facade_conv_t, + details::merge_facade_conv_t< + Cs, F, + details::add_facade_deprecation_traits::value>, + details::merge_tuple_t, + details::merge_size(MaxSize, F::max_size), + details::merge_size(MaxAlign, F::max_align), + details::merge_constraint(Copyability, F::copyability), + details::merge_constraint(Relocatability, F::relocatability), + details::merge_constraint(Destructibility, F::destructibility)>; + template + using add_facade_with_substitution = basic_facade_builder< + details::merge_facade_conv_t, details::merge_tuple_t, details::merge_size(MaxSize, F::max_size), details::merge_size(MaxAlign, F::max_align), diff --git a/tests/proxy_creation_tests.cpp b/tests/proxy_creation_tests.cpp index d88dc24..8c855f6 100644 --- a/tests/proxy_creation_tests.cpp +++ b/tests/proxy_creation_tests.cpp @@ -167,10 +167,11 @@ struct TestSharedStringable ::add_direct_reflection // ::build {}; -struct TestWeakSharedStringable : pro::facade_builder // - ::add_facade // - ::add_skill // - ::build {}; +struct TestWeakSharedStringable + : pro::facade_builder // + ::add_facade_with_substitution // + ::add_skill // + ::build {}; static_assert(pro::proxiable); static_assert(!pro::proxiable); diff --git a/tests/proxy_lifetime_tests.cpp b/tests/proxy_lifetime_tests.cpp index 24d5e49..7818f47 100644 --- a/tests/proxy_lifetime_tests.cpp +++ b/tests/proxy_lifetime_tests.cpp @@ -28,7 +28,7 @@ struct TestTrivialFacade struct TestRttiFacade : pro::facade_builder // ::add_direct_reflection // - ::add_facade // + ::add_facade_with_substitution // ::build {}; // Additional static asserts for substitution diff --git a/tests/proxy_view_tests.cpp b/tests/proxy_view_tests.cpp index f47f5b0..df18332 100644 --- a/tests/proxy_view_tests.cpp +++ b/tests/proxy_view_tests.cpp @@ -139,9 +139,9 @@ TEST(ProxyViewTests, TestOverloadShadowing) { TEST(ProxyViewTests, TestSubstitution_FromNull) { struct TestFacade1 : pro::facade_builder::build {}; - struct TestFacade2 : pro::facade_builder // - ::add_facade // Supports substitution - ::add_skill // + struct TestFacade2 : pro::facade_builder // + ::add_facade_with_substitution // + ::add_skill // ::build {}; pro::proxy p1; pro::proxy_view p2 = p1; @@ -158,8 +158,8 @@ TEST(ProxyViewTests, TestSubstitution_FromValue) { ::build {}; struct TestFacade2 : pro::facade_builder // ::support_copy // - ::add_facade // Supports substitution - ::add_skill // + ::add_facade_with_substitution // + ::add_skill // ::build {}; pro::proxy p1 = pro::make_proxy(123); pro::proxy_view p2 = p1;