[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Re: MM with temporaries
From: |
Nathaniel Smith |
Subject: |
Re: [Monotone-devel] Re: MM with temporaries |
Date: |
Fri, 23 Sep 2005 02:01:45 -0700 |
User-agent: |
Mutt/1.5.9i |
On Fri, Sep 23, 2005 at 01:47:29AM -0700, Nathaniel Smith wrote:
> That last part doesn't sound happy-making to me. IIUC, we have a
> temporary bound to a reference member, but we need it to persist until
> the object is destructed, which is much longer than "until the
> constructor exits"...
>
> This section is extremely opaque to me, though...
Oh, god, right, _but_, we could define _another_ const reference on the
stack, assign our argument to that, and then pass _that_ to the Musing
constructor...
Something like:
#define real_M(obj, line) \
typeof(obj) const & this_is_a_musing_fnord_ref_ ## line = obj; \
Musing<typeof(obj)> this_is_a_musing_fnord_object_ ## line \
(this_is_a_musing_fnord_ref_ ## line, #obj, __FILE__, __LINE__, \
BOOST_CURRENT_FUNCTION)
#define fake_M(obj, line) real_M(obj, line)
#define MM(obj) fake_M(obj, __LINE__)
And hopefully the compiler would kill the actual reference in most
cases, and not even allocate stack for it.
Horrifying; yet strangely compelling.
-- Nathaniel
--
"But in Middle-earth, the distinct accusative case disappeared from
the speech of the Noldor (such things happen when you are busy
fighting Orcs, Balrogs, and Dragons)."
Re: [Monotone-devel] MM with temporaries, Christof Petig, 2005/09/23