$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: David B. Held (dheld_at_[hidden])
Date: 2002-05-02 18:34:42
"Andrei Alexandrescu" <andrewalex_at_[hidden]> wrote in message
news:aas3gb$dkc$1_at_main.gmane.org...
> "David Abrahams" <david.abrahams_at_[hidden]> wrote in message
> news:133a01c1f1c7$00b96320$6401a8c0_at_boostconsulting.com...
> [...]
> > 3. Is using public inheritance at all really important? My impression
> > is that you do this to allow the policies to add interface to the
> > smart_ptr... while at the same time you eschew public member
> > functions.
I just understood what Dave was really saying. Doh!
> Hey, I think it would be a great idea to use private inheritance. That
way,
> policies can enhance interface only through free functions, which is my
> intent anyway. What do others think?
I'm afraid I don't know how it works, now. Consider:
template <typename T>
class MyPolicy
{
protected:
friend inline void free_function(const MyPolicy& ???);
};
If smart_ptr inherits privately from MyPolicy, there is no way for
free_function() to know that a smart_ptr is really a MyPolicy.
Otherwise, we would need to specify the full pointer type, which
the policy shouldn't know about, should it?
Dave