Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr on template class
From: Sebastian Mach (phresnel_at_[hidden])
Date: 2009-08-20 04:50:15


>
> typedef MyClass<P1> me;
> typedef boost::shared_ptr<me> pointer;
>
> so, later everything will depend on "me", for example: return pointer(new
> me);
> Also, this code could be reused when creating other classes.

Note that this is not necessary:

template <typename T> struct Foo {
        Foo foobar ();
};

template <typename T> Foo<T> Foo<T>::foobar () {
        return Foo(); // << referred to Foo<T> implicitly
}

int main () {
        Foo<void> foo;
        Foo<void> phoo = foo.foobar();
}

Inside the class declaration and inside corpora of member functions, the
unqualified class name is an alias for the qualified one.

Or did I misunderstood something?

Sebastian Mach
http://phresnel.org



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net