@@ -1465,9 +1465,16 @@ constexpr proxy<F> make_proxy_shared_impl(Args&&... args) {
1465
1465
template <facade F> struct observer_facade ;
1466
1466
template <facade F> using proxy_view = proxy<observer_facade<F>>;
1467
1467
1468
+ template <facade F> struct weak_facade ;
1469
+ template <facade F> using weak_proxy = proxy<weak_facade<F>>;
1470
+
1468
1471
template <class T , class F >
1469
1472
concept inplace_proxiable_target = proxiable<details::inplace_ptr<T>, F>;
1470
1473
1474
+ template <class T , class F >
1475
+ concept proxiable_target = proxiable<
1476
+ details::observer_ptr<T&, const T&, T&&, const T&&>, observer_facade<F>>;
1477
+
1471
1478
template <facade F, class T , class ... Args>
1472
1479
constexpr proxy<F> make_proxy_inplace (Args&&... args)
1473
1480
noexcept (std::is_nothrow_constructible_v<T, Args...>)
@@ -1492,20 +1499,13 @@ constexpr proxy<F> make_proxy_inplace(T&& value)
1492
1499
std::in_place, std::forward<T>(value)};
1493
1500
}
1494
1501
1495
- template <class T , class F >
1496
- concept proxiable_target = proxiable<
1497
- details::observer_ptr<T&, const T&, T&&, const T&&>, observer_facade<F>>;
1498
-
1499
1502
template <facade F, class T >
1500
1503
constexpr proxy_view<F> make_proxy_view (T& value) noexcept {
1501
1504
return proxy_view<F>{
1502
1505
details::observer_ptr<T&, const T&, T&&, const T&&>{value}};
1503
1506
}
1504
1507
1505
1508
#if __STDC_HOSTED__
1506
- template <facade F> struct weak_facade ;
1507
- template <facade F> using weak_proxy = proxy<weak_facade<F>>;
1508
-
1509
1509
template <facade F, class T , class Alloc , class ... Args>
1510
1510
constexpr proxy<F> allocate_proxy (const Alloc& alloc, Args&&... args)
1511
1511
requires(std::is_constructible_v<T, Args...>) {
@@ -2029,11 +2029,12 @@ struct sign {
2029
2029
template <std::size_t N>
2030
2030
sign (const char (&str)[N]) -> sign<N>;
2031
2031
2032
- #if __STDC_HOSTED__
2033
2032
struct weak_conversion_dispatch : cast_dispatch_base<false , true > {
2034
2033
template <class P >
2035
2034
___PRO_STATIC_CALL (auto , const P& self) noexcept
2036
- requires (requires { typename P::weak_type; } &&
2035
+ requires (
2036
+ requires (const typename P::weak_type& w)
2037
+ { { w.lock () } noexcept -> std::same_as<P>; } &&
2037
2038
std::is_convertible_v<const P&, typename P::weak_type>)
2038
2039
{ return typename P::weak_type{self}; }
2039
2040
};
@@ -2063,6 +2064,7 @@ auto weak_lock_impl(const P& self) noexcept
2063
2064
{ return nullable_ptr_adapter{self.lock ()}; }
2064
2065
PRO_DEF_FREE_AS_MEM_DISPATCH (weak_mem_lock, weak_lock_impl, lock);
2065
2066
2067
+ #if __STDC_HOSTED__
2066
2068
template <class CharT > struct format_overload_traits ;
2067
2069
template <>
2068
2070
struct format_overload_traits <char >
@@ -2263,8 +2265,6 @@ struct basic_facade_builder {
2263
2265
using support_destruction = basic_facade_builder<
2264
2266
Cs, Rs, details::make_destructible(C, CL)>;
2265
2267
#if __STDC_HOSTED__
2266
- using support_weak = add_direct_convention<details::weak_conversion_dispatch,
2267
- facade_aware_overload_t <details::weak_conversion_overload>>;
2268
2268
using support_format = add_convention<
2269
2269
details::format_dispatch, details::format_overload_t <char >>;
2270
2270
using support_wformat = add_convention<
@@ -2289,6 +2289,8 @@ struct basic_facade_builder {
2289
2289
#endif // __cpp_rtti >= 199711L
2290
2290
using support_view = add_direct_convention<details::proxy_view_dispatch,
2291
2291
facade_aware_overload_t <details::proxy_view_overload>>;
2292
+ using support_weak = add_direct_convention<details::weak_conversion_dispatch,
2293
+ facade_aware_overload_t <details::weak_conversion_overload>>;
2292
2294
using build = details::facade_impl<Cs, Rs, details::normalize(C)>;
2293
2295
basic_facade_builder () = delete;
2294
2296
};
@@ -2300,16 +2302,6 @@ using facade_builder = basic_facade_builder<std::tuple<>, std::tuple<>,
2300
2302
.relocatability = details::invalid_cl,
2301
2303
.destructibility = details::invalid_cl}>;
2302
2304
2303
- #if __STDC_HOSTED__
2304
- template <facade F>
2305
- struct weak_facade {
2306
- using convention_types = std::tuple<details::conv_impl<
2307
- true , details::weak_mem_lock, proxy<F>() const noexcept >>;
2308
- using reflection_types = std::tuple<>;
2309
- static constexpr auto constraints = F::constraints;
2310
- };
2311
- #endif // __STDC_HOSTED__
2312
-
2313
2305
template <facade F>
2314
2306
struct observer_facade
2315
2307
: details::instantiated_t <details::observer_facade_conv_impl,
@@ -2323,6 +2315,14 @@ struct observer_facade
2323
2315
.destructibility = constraint_level::trivial};
2324
2316
};
2325
2317
2318
+ template <facade F>
2319
+ struct weak_facade {
2320
+ using convention_types = std::tuple<details::conv_impl<
2321
+ true , details::weak_mem_lock, proxy<F>() const noexcept >>;
2322
+ using reflection_types = std::tuple<>;
2323
+ static constexpr auto constraints = F::constraints;
2324
+ };
2325
+
2326
2326
template <details::sign Sign, bool Rhs = false >
2327
2327
struct operator_dispatch ;
2328
2328
0 commit comments