Boost logo

Boost :

From: Dan W. (danw_at_[hidden])
Date: 2004-01-09 01:13:20


Daniel Wallin wrote:
> template<class T>
> struct B
> {
> struct type {};
> };
> template<class T>
> struct A : B<A<T> >
> {
> void f()
> {
> /* typename */ B<A<T> >::type x;
> /* ^^^^^^^^ needed here */
> }
> };
...
> You can try this example, which does the same thing that your code
> does, out at:
>
> http://www.comeaucomputing.com/tryitout/

You're absolutely right. Thanks. Handy link to have.
I've ended up with something pretty similar to your solution, no more
inheritance, etc. Now I have a problem: your trick of assigning a
temporary to a reference on the stack doesn't seem to work on my
compiler. Is that required to work in the standard? Namely,

struct base {};

struct derived {};

derived make_temp_derived(){ return derived; }

//scope..
{
    base const & b = make_temp_derived();
    ...
} <- the created temporary should last till here?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk