From c8deb2a30d92a7102be16c7053d0ac735f652c76 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 15 Dec 2025 22:43:21 -0500 Subject: [PATCH] xo-alloc2 : work on X1Collector unit test [WIP] --- include/xo/facet/obj.hpp | 17 ++++++++++++++--- utest/objectmodel.test.cpp | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/xo/facet/obj.hpp b/include/xo/facet/obj.hpp index a90de8c6..2eed0bfa 100644 --- a/include/xo/facet/obj.hpp +++ b/include/xo/facet/obj.hpp @@ -52,9 +52,9 @@ namespace xo { /** copy constructor **/ template - obj(const obj && other) - requires (std::is_convertible_v - || std::is_same_v) + obj(const obj & other) + requires (std::is_same_v + || std::is_convertible_v) : Super() { if constexpr (std::is_convertible_v) { @@ -89,11 +89,22 @@ namespace xo { } }; + /** Use: + * auto o = with_facet::obj(&data); + **/ + template + struct with_facet { + template + static obj mkobj(DRepr * data) { obj x(data); return x; } + }; + +#ifdef DEPRECATED template inline obj with_facet(DRepr * data) { return obj(data); } +#endif } /*namespace facet*/ using facet::obj; diff --git a/utest/objectmodel.test.cpp b/utest/objectmodel.test.cpp index 610c16e0..afb27c13 100644 --- a/utest/objectmodel.test.cpp +++ b/utest/objectmodel.test.cpp @@ -353,7 +353,7 @@ namespace xo { TEST_CASE("obj-rect-1", "[facet]") { DRectCoords z1{1.0, 0.0}; - auto z1o = with_facet(&z1); + auto z1o = with_facet::mkobj(&z1); static_assert(std::is_same_v); static_assert(std::is_same_v);