Boost logo

Boost Users :

From: Jens Theisen (jth01_at_[hidden])
Date: 2006-01-25 15:46:00


David wrote:

>> 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.

You can always do

template< typename Pointer >
void print_handle(Pointer const& ptr)
{
  std::cout << *ptr << std::endl;
}

which will work on any smart pointer.

The drawbacks are more weird error messages and less precise overload
resolution since the above matches on any type, not only pointers.

> Would the upcoming template typedef feature
> avoid the need to specify Type in the call?

I doubt it, though I haven't read the proposal. I'm pretty it's about an
abbreviation for traits classes so it's not going to introduce something
you don't have.

Jens


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