xo-alloc2 : work on X1Collector unit test [WIP]
This commit is contained in:
parent
7fb5cfb432
commit
c8deb2a30d
2 changed files with 15 additions and 4 deletions
|
|
@ -52,9 +52,9 @@ namespace xo {
|
|||
|
||||
/** copy constructor **/
|
||||
template <typename DOther>
|
||||
obj(const obj<AFacet, DOther> && other)
|
||||
requires (std::is_convertible_v<DRepr, DOther>
|
||||
|| std::is_same_v<DRepr, DVariantPlaceholder>)
|
||||
obj(const obj<AFacet, DOther> & other)
|
||||
requires (std::is_same_v<DRepr, DVariantPlaceholder>
|
||||
|| std::is_convertible_v<DRepr, DOther>)
|
||||
: Super()
|
||||
{
|
||||
if constexpr (std::is_convertible_v<DRepr, DOther>) {
|
||||
|
|
@ -89,11 +89,22 @@ namespace xo {
|
|||
}
|
||||
};
|
||||
|
||||
/** Use:
|
||||
* auto o = with_facet<AAllocator>::obj(&data);
|
||||
**/
|
||||
template <typename AFacet>
|
||||
struct with_facet {
|
||||
template <typename DRepr>
|
||||
static obj<AFacet, DRepr> mkobj(DRepr * data) { obj<AFacet, DRepr> x(data); return x; }
|
||||
};
|
||||
|
||||
#ifdef DEPRECATED
|
||||
template <typename AFacet, typename DRepr>
|
||||
inline obj<AFacet, DRepr>
|
||||
with_facet(DRepr * data) {
|
||||
return obj<AFacet, DRepr>(data);
|
||||
}
|
||||
#endif
|
||||
} /*namespace facet*/
|
||||
|
||||
using facet::obj;
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ namespace xo {
|
|||
TEST_CASE("obj-rect-1", "[facet]")
|
||||
{
|
||||
DRectCoords z1{1.0, 0.0};
|
||||
auto z1o = with_facet<AComplex>(&z1);
|
||||
auto z1o = with_facet<AComplex>::mkobj(&z1);
|
||||
|
||||
static_assert(std::is_same_v<decltype(z1o)::FacetType, AComplex>);
|
||||
static_assert(std::is_same_v<decltype(z1o)::DataType, DRectCoords>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue