Boost logo

Boost :

Subject: Re: [boost] Review Request: impl_ptr (pimpl)
From: Vladimir Batov (Vladimir.Batov_at_[hidden])
Date: 2017-08-21 09:48:55

On 2017-08-21 16:29, Andrzej Krzemienski via Boost wrote:
> 2017-08-20 0:46 GMT+02:00 Vladimir Batov via Boost
> <boost_at_[hidden]>:
>> 2) As I think I mentioned before impl_ptr is not part of any namespace
>> by
>> design... because the way proxy and implementation are connected, the
>> specialization of impl_ptr<>::implementation. As I also mentioned it
>> is IMO
>> only a "problem" for "purists" but not for "practitioners" as from
>> outside
>> it is all kosher and accessed via boost::impl_ptr.
> Could you summarize why using the global namespace is necessary?

template<> struct impl_ptr<Foo>::implementation is a template
specialization. So, it has to be defined in the original namespace. So,
if it is

namespace boost
     template<typename> struct impl_ptr;

then the developer will have to declare his specialization of
"implementation" inside boost:

namespace boost
     template<> struct impl_ptr<Foo>::implementation { ... };

That's ugly and wrong. So, I did

template<typename> struct _internal_boost_impl_ptr;

namespace boost
     template<typename T> using impl_ptr = ::_internal_boost_impl_ptr<T>;

Now for all purposes impl_ptr appears as "boost::impl_ptr". Then, the
developer defines his "implementation" specialization like

template<> struct boost::impl_ptr<Foo>::implementation { ... };

which looks sensible IMO.

Boost list run by bdawes at, gregod at, cpdaniel at, john at