From 1dc896a6a4642f308c4b02104e78ff4c60bda777 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Thu, 19 Mar 2026 17:06:55 +0800 Subject: [PATCH 1/9] Add API `make_proxy_ref` --- docs/spec/.pages | 1 + docs/spec/README.md | 1 + docs/spec/make_proxy_ref.md | 50 ++++++++++++++++++++++++++++++++++ include/proxy/v4/proxy.h | 5 ++++ tests/proxy_creation_tests.cpp | 24 ++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 docs/spec/make_proxy_ref.md diff --git a/docs/spec/.pages b/docs/spec/.pages index 2b6247c..d824a0d 100644 --- a/docs/spec/.pages +++ b/docs/spec/.pages @@ -32,6 +32,7 @@ nav: - allocate_proxy_shared: allocate_proxy_shared.md - allocate_proxy: allocate_proxy.md - make_proxy_inplace: make_proxy_inplace.md + - make_proxy_ref: make_proxy_ref.md - make_proxy_shared: make_proxy_shared.md - make_proxy_view: make_proxy_view.md - make_proxy: make_proxy.md diff --git a/docs/spec/README.md b/docs/spec/README.md index 255903e..f62de07 100644 --- a/docs/spec/README.md +++ b/docs/spec/README.md @@ -52,6 +52,7 @@ This document provides the API specifications for the C++ library Proxy (version | [`allocate_proxy_shared`](allocate_proxy_shared.md) | Creates a `proxy` object with shared ownership using an allocator | | [`allocate_proxy`](allocate_proxy.md) | Creates a `proxy` object with an allocator | | [`make_proxy_inplace`](make_proxy_inplace.md) | Creates a `proxy` object with strong no-allocation guarantee | +| [`make_proxy_ref`](make_proxy_ref.md) | Creates a `proxy` object with no ownership | | [`make_proxy_shared`](make_proxy_shared.md) | Creates a `proxy` object with shared ownership | | [`make_proxy_view`](make_proxy_view.md) | Creates a `proxy_view` object | | [`make_proxy`](make_proxy.md) | Creates a `proxy` object potentially with heap allocation | diff --git a/docs/spec/make_proxy_ref.md b/docs/spec/make_proxy_ref.md new file mode 100644 index 0000000..2a5ae0a --- /dev/null +++ b/docs/spec/make_proxy_ref.md @@ -0,0 +1,50 @@ +# Function template `make_proxy_ref` + +> Header: `proxy.h` +> Module: `proxy` +> Namespace: `pro::inline v4` +> Since: 4.1.0 + +The definition of `make_proxy_ref` makes use of an exposition-only class template *observer-ptr*. `observer-ptr` contains a raw pointer to an object of type `T`, and provides `operator*` for access with the same qualifiers. + +```cpp +template +proxy make_proxy_ref(T& value) noexcept; +``` + +Creates a `proxy` object containing a value `p` of type `observer-ptr`, where `*p` is direct-non-list-initialized with `&value`. If [`proxiable_target`](proxiable_target.md) is `false`, the program is ill-formed and diagnostic messages are generated. + +## Return Value + +The constructed `proxy` object. + +## Example + +```cpp +#include + +#include + +struct Printable : pro::facade_builder // + ::add_convention, + std::ostream&(std::ostream&) const> // + ::build {}; + +int main() { + int val = 123; + pro::proxy p = pro::make_proxy_ref(val); + + // Prints "123" + std::cout << *p << "\n"; + + val = 456; + + // Prints "456" + std::cout << *p << "\n"; +} +``` + +## See Also + +- [concept `proxiable_target`](proxiable_target.md) +- [function template `make_proxy_view`](make_proxy_view.md) \ No newline at end of file diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index ae9903f..591613c 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -1818,6 +1818,11 @@ constexpr proxy make_proxy_inplace(T&& value) noexcept( std::in_place, std::forward(value)}; } +template +constexpr proxy make_proxy_ref(T& value) noexcept { + return proxy{details::observer_ptr{value}}; +} + template constexpr proxy_view make_proxy_view(T& value) noexcept { return proxy_view{ diff --git a/tests/proxy_creation_tests.cpp b/tests/proxy_creation_tests.cpp index d88dc24..834400d 100644 --- a/tests/proxy_creation_tests.cpp +++ b/tests/proxy_creation_tests.cpp @@ -1222,3 +1222,27 @@ TEST(ProxyCreationTests, TestMakeProxyView) { p = pro::make_proxy_view(test_callable); ASSERT_EQ((*std::move(std::as_const(p)))(), 3); } + +TEST(ProxyCreationTests, TestMakeProxyRef) { + struct TestFacade + : pro::facade_builder // + ::add_convention, int() &, int() const&, + int() && noexcept, int() const&&> // + ::build {}; + + struct { + int operator()() & noexcept { return 0; } + int operator()() const& noexcept { return 1; } + int operator()() && noexcept { return 2; } + int operator()() const&& noexcept { return 3; } + } test_callable; + + pro::proxy p = pro::make_proxy_ref(test_callable); + static_assert(!noexcept((*p)())); + static_assert(noexcept((*std::move(p))())); + ASSERT_EQ((*p)(), 0); + ASSERT_EQ((*std::as_const(p))(), 1); + ASSERT_EQ((*std::move(p))(), 2); + p = pro::make_proxy_ref(test_callable); + ASSERT_EQ((*std::move(std::as_const(p)))(), 3); +} From cf37e19c80d1d58e66d5ba87ac7025d34793ec56 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Thu, 19 Mar 2026 17:20:15 +0800 Subject: [PATCH 2/9] Update docs --- docs/spec/make_proxy_view.md | 4 +--- include/proxy/v4/proxy.h | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/spec/make_proxy_view.md b/docs/spec/make_proxy_view.md index d70b61a..241213a 100644 --- a/docs/spec/make_proxy_view.md +++ b/docs/spec/make_proxy_view.md @@ -5,14 +5,12 @@ > Namespace: `pro::inline v4` > Since: 3.3.0 -The definition of `make_proxy_view` makes use of an exposition-only class template *observer-ptr*. `observer-ptr` contains a raw pointer to an object of type `T`, and provides `operator*` for access with the same qualifiers. - ```cpp template proxy_view make_proxy_view(T& value) noexcept; ``` -Creates a `proxy_view` object containing a value `p` of type `observer-ptr`, where `*p` is direct-non-list-initialized with `&value`. If [`proxiable_target`](proxiable_target.md) is `false`, the program is ill-formed and diagnostic messages are generated. +Equivalent to `return make_proxy_ref>(value)`. ## Return Value diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index 591613c..f0db0c6 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -1825,8 +1825,7 @@ constexpr proxy make_proxy_ref(T& value) noexcept { template constexpr proxy_view make_proxy_view(T& value) noexcept { - return proxy_view{ - details::observer_ptr{value}}; + return make_proxy_ref>(value); } #if __STDC_HOSTED__ From 63f2b909f1f0d2fe9c357ec36bb3c8a43c92411f Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Thu, 19 Mar 2026 17:25:47 +0800 Subject: [PATCH 3/9] Update proxiable_target --- include/proxy/v4/proxy.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index f0db0c6..91db8d7 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -1784,8 +1784,7 @@ concept inplace_proxiable_target = proxiable, F>; template concept proxiable_target = - proxiable, - observer_facade>; + proxiable, F>; template requires(is_bitwise_trivially_relocatable_v) From 2b9304268ee7fd88890f2a9e1ae8886f96006934 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Thu, 19 Mar 2026 17:59:00 +0800 Subject: [PATCH 4/9] Update wording --- docs/spec/proxiable_target.md | 2 +- docs/spec/proxy_view.md | 2 +- docs/spec/skills_as_view.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/spec/proxiable_target.md b/docs/spec/proxiable_target.md index 403bc55..d263721 100644 --- a/docs/spec/proxiable_target.md +++ b/docs/spec/proxiable_target.md @@ -10,7 +10,7 @@ template concept proxiable_target = proxiable, F>; ``` -See [`make_proxy_view`](make_proxy_view.md) for the definition of the exposition-only class template *observer-ptr*. +See [`make_proxy_ref`](make_proxy_ref.md) for the definition of the exposition-only class template *observer-ptr*. ## Example diff --git a/docs/spec/proxy_view.md b/docs/spec/proxy_view.md index 2f81c5d..738bf18 100644 --- a/docs/spec/proxy_view.md +++ b/docs/spec/proxy_view.md @@ -13,7 +13,7 @@ template using proxy_view = proxy>; ``` -`proxy_view` is a non-owning, trivially copyable, trivially relocatable view of an object that models [`proxiable_target`](proxiable_target.md). It behaves like a `proxy` except that it never owns the lifetime of the underlying object. +`proxy_view` is a non-owning, trivially copyable, trivially relocatable view of an object that models [`proxiable_target>`](proxiable_target.md). It behaves like a `proxy` except that it never owns the lifetime of the underlying object. `observer_facade` adapts an existing [facade](facade.md) `F` for this non-owning use. The adaptation preserves only those parts of `F` that remain semantically valid when the storage is reduced to a single pointer and modifies substitution conversions so that view-ness is preserved (substitution that would have produced an owning `proxy` instead produces a `proxy_view`). diff --git a/docs/spec/skills_as_view.md b/docs/spec/skills_as_view.md index aafe7a3..bb79d42 100644 --- a/docs/spec/skills_as_view.md +++ b/docs/spec/skills_as_view.md @@ -12,7 +12,7 @@ using as_view = /* see below */; The alias template `as_view` modifies a specialization of [`basic_facade_builder`](basic_facade_builder/README.md) to allow implicit conversion from [`proxy`](proxy/README.md)`` to [`proxy_view`](proxy_view.md)``, where `F` is a built [facade](facade.md) type. -Let `p` be a value of type `proxy`, `ptr` be the contained value of `p` (if any), the conversion from type `proxy&` to type `proxy_view` is equivalent to `return observer-ptr{std::addressof(*ptr)}` if `p` contains a value, or otherwise equivalent to `return nullptr`. `observer-ptr` is an exposition-only type that `*observer-ptr`, `*std::as_const(observer-ptr)`, `*std::move(observer-ptr)` and `*std::move(std::as_const(observer-ptr))` are equivalent to `*ptr`, `*std::as_const(ptr)`, `*std::move(ptr)` and `*std::move(std::as_const(ptr))`, respectively. +Let `p` be a value of type `proxy`, `ptr` be the contained value of `p` (if any), the conversion from type `proxy&` to type `proxy_view` is equivalent to `return make_proxy_view(*ptr)` if `p` contains a value, or otherwise equivalent to `return nullptr`. ## Notes From 242ddc324ba7996611726556f83c373cf0abae6e Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Thu, 19 Mar 2026 18:00:59 +0800 Subject: [PATCH 5/9] Update modules --- include/proxy/v4/proxy.ixx | 1 + 1 file changed, 1 insertion(+) diff --git a/include/proxy/v4/proxy.ixx b/include/proxy/v4/proxy.ixx index 37fb981..aeb83e8 100644 --- a/include/proxy/v4/proxy.ixx +++ b/include/proxy/v4/proxy.ixx @@ -22,6 +22,7 @@ using v4::is_bitwise_trivially_relocatable; using v4::is_bitwise_trivially_relocatable_v; using v4::make_proxy; using v4::make_proxy_inplace; +using v4::make_proxy_ref; using v4::make_proxy_shared; using v4::make_proxy_view; using v4::not_implemented; From ab0b3583612c04aaa7009cd06497c4e371910eb5 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Fri, 20 Mar 2026 16:23:46 +0800 Subject: [PATCH 6/9] Add files --- docs/spec/make_proxy_ref.md | 2 +- docs/spec/proxiable_target.md | 2 +- docs/spec/proxy_view.md | 2 +- include/proxy/v4/proxy.h | 3 ++- tests/proxy_creation_tests.cpp | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/spec/make_proxy_ref.md b/docs/spec/make_proxy_ref.md index 2a5ae0a..4e5f691 100644 --- a/docs/spec/make_proxy_ref.md +++ b/docs/spec/make_proxy_ref.md @@ -12,7 +12,7 @@ template proxy make_proxy_ref(T& value) noexcept; ``` -Creates a `proxy` object containing a value `p` of type `observer-ptr`, where `*p` is direct-non-list-initialized with `&value`. If [`proxiable_target`](proxiable_target.md) is `false`, the program is ill-formed and diagnostic messages are generated. +Creates a `proxy` object containing a value `p` of type `observer-ptr`, where `*p` is direct-non-list-initialized with `std::addressof(value)`. If [`proxiable_target`](proxiable_target.md) is `false`, the program is ill-formed and diagnostic messages are generated. ## Return Value diff --git a/docs/spec/proxiable_target.md b/docs/spec/proxiable_target.md index d263721..6a90585 100644 --- a/docs/spec/proxiable_target.md +++ b/docs/spec/proxiable_target.md @@ -7,7 +7,7 @@ ```cpp template -concept proxiable_target = proxiable, F>; +concept proxiable_target = proxiable, observer_facade>; ``` See [`make_proxy_ref`](make_proxy_ref.md) for the definition of the exposition-only class template *observer-ptr*. diff --git a/docs/spec/proxy_view.md b/docs/spec/proxy_view.md index 738bf18..2f81c5d 100644 --- a/docs/spec/proxy_view.md +++ b/docs/spec/proxy_view.md @@ -13,7 +13,7 @@ template using proxy_view = proxy>; ``` -`proxy_view` is a non-owning, trivially copyable, trivially relocatable view of an object that models [`proxiable_target>`](proxiable_target.md). It behaves like a `proxy` except that it never owns the lifetime of the underlying object. +`proxy_view` is a non-owning, trivially copyable, trivially relocatable view of an object that models [`proxiable_target`](proxiable_target.md). It behaves like a `proxy` except that it never owns the lifetime of the underlying object. `observer_facade` adapts an existing [facade](facade.md) `F` for this non-owning use. The adaptation preserves only those parts of `F` that remain semantically valid when the storage is reduced to a single pointer and modifies substitution conversions so that view-ness is preserved (substitution that would have produced an owning `proxy` instead produces a `proxy_view`). diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index 91db8d7..f0db0c6 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -1784,7 +1784,8 @@ concept inplace_proxiable_target = proxiable, F>; template concept proxiable_target = - proxiable, F>; + proxiable, + observer_facade>; template requires(is_bitwise_trivially_relocatable_v) diff --git a/tests/proxy_creation_tests.cpp b/tests/proxy_creation_tests.cpp index 834400d..d1c83ac 100644 --- a/tests/proxy_creation_tests.cpp +++ b/tests/proxy_creation_tests.cpp @@ -174,6 +174,7 @@ struct TestWeakSharedStringable : pro::facade_builder // static_assert(pro::proxiable); static_assert(!pro::proxiable); +static_assert(pro::proxiable_target); } // namespace proxy_creation_tests_details From cdebb016f2e438f86bc6c3e17f779404471e2019 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Fri, 20 Mar 2026 16:33:55 +0800 Subject: [PATCH 7/9] Fix wording --- docs/spec/skills_as_view.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/skills_as_view.md b/docs/spec/skills_as_view.md index bb79d42..9131df9 100644 --- a/docs/spec/skills_as_view.md +++ b/docs/spec/skills_as_view.md @@ -12,7 +12,7 @@ using as_view = /* see below */; The alias template `as_view` modifies a specialization of [`basic_facade_builder`](basic_facade_builder/README.md) to allow implicit conversion from [`proxy`](proxy/README.md)`` to [`proxy_view`](proxy_view.md)``, where `F` is a built [facade](facade.md) type. -Let `p` be a value of type `proxy`, `ptr` be the contained value of `p` (if any), the conversion from type `proxy&` to type `proxy_view` is equivalent to `return make_proxy_view(*ptr)` if `p` contains a value, or otherwise equivalent to `return nullptr`. +Let `p` be a value of type `proxy`, `ptr` be the contained value of `p` (if any), the conversion from type `proxy&` to type `proxy_view` is equivalent to `return make_proxy_view(*ptr)` if `p` contains a value, or otherwise equivalent to `return nullptr`. ## Notes From 7ff267b2c3fd0091c718ef62d98737442dc0adcd Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Fri, 20 Mar 2026 17:19:07 +0800 Subject: [PATCH 8/9] Rename to make_proxy_observed --- docs/spec/.pages | 2 +- docs/spec/README.md | 2 +- docs/spec/{make_proxy_ref.md => make_proxy_observed.md} | 8 ++++---- docs/spec/make_proxy_view.md | 2 +- docs/spec/proxiable_target.md | 2 +- include/proxy/v4/proxy.h | 4 ++-- include/proxy/v4/proxy.ixx | 2 +- tests/proxy_creation_tests.cpp | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) rename docs/spec/{make_proxy_ref.md => make_proxy_observed.md} (72%) diff --git a/docs/spec/.pages b/docs/spec/.pages index d824a0d..7c25ed0 100644 --- a/docs/spec/.pages +++ b/docs/spec/.pages @@ -32,7 +32,7 @@ nav: - allocate_proxy_shared: allocate_proxy_shared.md - allocate_proxy: allocate_proxy.md - make_proxy_inplace: make_proxy_inplace.md - - make_proxy_ref: make_proxy_ref.md + - make_proxy_observed: make_proxy_observed.md - make_proxy_shared: make_proxy_shared.md - make_proxy_view: make_proxy_view.md - make_proxy: make_proxy.md diff --git a/docs/spec/README.md b/docs/spec/README.md index f62de07..ea0113c 100644 --- a/docs/spec/README.md +++ b/docs/spec/README.md @@ -52,7 +52,7 @@ This document provides the API specifications for the C++ library Proxy (version | [`allocate_proxy_shared`](allocate_proxy_shared.md) | Creates a `proxy` object with shared ownership using an allocator | | [`allocate_proxy`](allocate_proxy.md) | Creates a `proxy` object with an allocator | | [`make_proxy_inplace`](make_proxy_inplace.md) | Creates a `proxy` object with strong no-allocation guarantee | -| [`make_proxy_ref`](make_proxy_ref.md) | Creates a `proxy` object with no ownership | +| [`make_proxy_observed`](make_proxy_observed.md) | Creates a `proxy` object with no ownership | | [`make_proxy_shared`](make_proxy_shared.md) | Creates a `proxy` object with shared ownership | | [`make_proxy_view`](make_proxy_view.md) | Creates a `proxy_view` object | | [`make_proxy`](make_proxy.md) | Creates a `proxy` object potentially with heap allocation | diff --git a/docs/spec/make_proxy_ref.md b/docs/spec/make_proxy_observed.md similarity index 72% rename from docs/spec/make_proxy_ref.md rename to docs/spec/make_proxy_observed.md index 4e5f691..6b97a2c 100644 --- a/docs/spec/make_proxy_ref.md +++ b/docs/spec/make_proxy_observed.md @@ -1,15 +1,15 @@ -# Function template `make_proxy_ref` +# Function template `make_proxy_observed` > Header: `proxy.h` > Module: `proxy` > Namespace: `pro::inline v4` > Since: 4.1.0 -The definition of `make_proxy_ref` makes use of an exposition-only class template *observer-ptr*. `observer-ptr` contains a raw pointer to an object of type `T`, and provides `operator*` for access with the same qualifiers. +The definition of `make_proxy_observed` makes use of an exposition-only class template *observer-ptr*. `observer-ptr` contains a raw pointer to an object of type `T`, and provides `operator*` for access with the same qualifiers. ```cpp template -proxy make_proxy_ref(T& value) noexcept; +proxy make_proxy_observed(T& value) noexcept; ``` Creates a `proxy` object containing a value `p` of type `observer-ptr`, where `*p` is direct-non-list-initialized with `std::addressof(value)`. If [`proxiable_target`](proxiable_target.md) is `false`, the program is ill-formed and diagnostic messages are generated. @@ -32,7 +32,7 @@ struct Printable : pro::facade_builder // int main() { int val = 123; - pro::proxy p = pro::make_proxy_ref(val); + pro::proxy p = pro::make_proxy_observed(val); // Prints "123" std::cout << *p << "\n"; diff --git a/docs/spec/make_proxy_view.md b/docs/spec/make_proxy_view.md index 241213a..22e0571 100644 --- a/docs/spec/make_proxy_view.md +++ b/docs/spec/make_proxy_view.md @@ -10,7 +10,7 @@ template proxy_view make_proxy_view(T& value) noexcept; ``` -Equivalent to `return make_proxy_ref>(value)`. +Equivalent to `return make_proxy_observed>(value)`. ## Return Value diff --git a/docs/spec/proxiable_target.md b/docs/spec/proxiable_target.md index 6a90585..b538a7a 100644 --- a/docs/spec/proxiable_target.md +++ b/docs/spec/proxiable_target.md @@ -10,7 +10,7 @@ template concept proxiable_target = proxiable, observer_facade>; ``` -See [`make_proxy_ref`](make_proxy_ref.md) for the definition of the exposition-only class template *observer-ptr*. +See [`make_proxy_observed`](make_proxy_observed.md) for the definition of the exposition-only class template *observer-ptr*. ## Example diff --git a/include/proxy/v4/proxy.h b/include/proxy/v4/proxy.h index f0db0c6..1c21a64 100644 --- a/include/proxy/v4/proxy.h +++ b/include/proxy/v4/proxy.h @@ -1819,13 +1819,13 @@ constexpr proxy make_proxy_inplace(T&& value) noexcept( } template -constexpr proxy make_proxy_ref(T& value) noexcept { +constexpr proxy make_proxy_observed(T& value) noexcept { return proxy{details::observer_ptr{value}}; } template constexpr proxy_view make_proxy_view(T& value) noexcept { - return make_proxy_ref>(value); + return make_proxy_observed>(value); } #if __STDC_HOSTED__ diff --git a/include/proxy/v4/proxy.ixx b/include/proxy/v4/proxy.ixx index aeb83e8..65614ba 100644 --- a/include/proxy/v4/proxy.ixx +++ b/include/proxy/v4/proxy.ixx @@ -22,7 +22,7 @@ using v4::is_bitwise_trivially_relocatable; using v4::is_bitwise_trivially_relocatable_v; using v4::make_proxy; using v4::make_proxy_inplace; -using v4::make_proxy_ref; +using v4::make_proxy_observed; using v4::make_proxy_shared; using v4::make_proxy_view; using v4::not_implemented; diff --git a/tests/proxy_creation_tests.cpp b/tests/proxy_creation_tests.cpp index d1c83ac..b47ecfe 100644 --- a/tests/proxy_creation_tests.cpp +++ b/tests/proxy_creation_tests.cpp @@ -1224,7 +1224,7 @@ TEST(ProxyCreationTests, TestMakeProxyView) { ASSERT_EQ((*std::move(std::as_const(p)))(), 3); } -TEST(ProxyCreationTests, TestMakeProxyRef) { +TEST(ProxyCreationTests, TestMakeProxyObserved) { struct TestFacade : pro::facade_builder // ::add_convention, int() &, int() const&, @@ -1238,12 +1238,12 @@ TEST(ProxyCreationTests, TestMakeProxyRef) { int operator()() const&& noexcept { return 3; } } test_callable; - pro::proxy p = pro::make_proxy_ref(test_callable); + pro::proxy p = pro::make_proxy_observed(test_callable); static_assert(!noexcept((*p)())); static_assert(noexcept((*std::move(p))())); ASSERT_EQ((*p)(), 0); ASSERT_EQ((*std::as_const(p))(), 1); ASSERT_EQ((*std::move(p))(), 2); - p = pro::make_proxy_ref(test_callable); + p = pro::make_proxy_observed(test_callable); ASSERT_EQ((*std::move(std::as_const(p)))(), 3); } From 4393df5ef2fa37c4a818913f77f2a87b9a444729 Mon Sep 17 00:00:00 2001 From: Mingxin Wang Date: Fri, 20 Mar 2026 17:22:13 +0800 Subject: [PATCH 9/9] Format --- tests/proxy_creation_tests.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/proxy_creation_tests.cpp b/tests/proxy_creation_tests.cpp index b47ecfe..b49e860 100644 --- a/tests/proxy_creation_tests.cpp +++ b/tests/proxy_creation_tests.cpp @@ -1238,7 +1238,8 @@ TEST(ProxyCreationTests, TestMakeProxyObserved) { int operator()() const&& noexcept { return 3; } } test_callable; - pro::proxy p = pro::make_proxy_observed(test_callable); + pro::proxy p = + pro::make_proxy_observed(test_callable); static_assert(!noexcept((*p)())); static_assert(noexcept((*std::move(p))())); ASSERT_EQ((*p)(), 0);