Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-01-25 14:14:24

> > Why is there a need? Presumably you're potential surrogate
> for shared_ptr
> > will also support operator *, and that's all you use in
> your function.
> Why is there a need to do what? I'm not following you here. I've
> gone through and specified Type everywhere in my application. It's
> ugly but it works. Would the upcoming template typedef feature
> avoid the need to specify Type in the call?

I think what Jens is getting at is that you should use the duck-typing
C++ templating affords you:

#include <boost/smart_ptr.hpp>
#include <iostream>

using namespace std;

template<typename Handle>
void print_handle(Handle p)
        cout << *p << endl;

int main()
        int * a = new int(5);
        boost::shared_ptr<int> b(new int(6));


$ ./a.out

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at