|
Boost : |
From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-01-10 04:56:20
Dan W. wrote:
> Daniel Wallin wrote:
>
>>>>> derived make_temp_derived(){ return derived; }
>>>>> //scope..
>>>>> {
>>>>> base const & b = make_temp_derived();
>>>>> ...
>>>>> } <- the created temporary should last till here?
>>>
>>>
>>> With my compiler, it gets destroyed immediately, so I made an
>>> implementation that simply instantiates the variable.
>>
>>
>> Which compiler is that? IHMO, there's only so much you should do to
>> handle non-conforming compilers; if a compiler fails to handle a thing
>> as simple as this it should be thrown out the window.
>
> <snip>
> BTW, do you think the invariants code is okay now?
Well, I think it's kind of disturbing to use a macro to declare the
check_invariants() function. If the compiler can't manage the lifetime
of temporaries I think you should file a bug report, not work around it
with macros that propagate to user code.
Also, note that:
template< typename T >
class EEICHK
{
friend class T;
^^^^^^^^^^^^^^^ illegal
};
There is no way to make a class template friend with it's template type.
-- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk