[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add and use a Transform data type (issue 344970043 by address@hidden
From: |
David Kastrup |
Subject: |
Re: Add and use a Transform data type (issue 344970043 by address@hidden) |
Date: |
Fri, 22 Jun 2018 14:27:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Hans Åberg <address@hidden> writes:
>> On 22 Jun 2018, at 11:09, David Kastrup <address@hidden> wrote:
>>
>> Hans Åberg <address@hidden> writes:
>>
>>>> You could also do it as a constructor, if you prefer its syntax and
>>>> don't mind implementing yet another one:
>>>>
>>>> explicit Transform(const Transform *t) ...
>>>
>>> One can also use a tag type argument in the constructor:
>>> struct make_t {};
>>> constexpr make_t make{};
>>
>> What would that be good for?
>
> There are various uses in the C++ library. I found it useful for in a
> reference class I wrote:
> template<class A>
> class ref {
> protected:
> A* data_ = nullptr;
>
> public:
> ...
> template<class... B>
> ref(make_t, B&&... bs) : data_(finalize(new (collect) A(bs...))) {}
> };
> A direct constructor taking an operator new pointer would not be able to do
> the GC registering.
>
> It admits a syntax:
> ref<A> a(make, ...);
> auto a = ref<A>(make, ...);
> with the ... arguments passed to the A constructor.
What would that be good for concerning this issue?
--
David Kastrup
Re: Add and use a Transform data type (issue 344970043 by address@hidden), dak, 2018/06/21
Re: Add and use a Transform data type (issue 344970043 by address@hidden), dak, 2018/06/21
Re: Add and use a Transform data type (issue 344970043 by address@hidden), nine . fierce . ballads, 2018/06/21