Boost logo

Boost :

Subject: Re: [boost] Pimpl Again?
From: Chris Glover (c.d.glover_at_[hidden])
Date: 2016-05-31 17:29:17


>
>
> I agree that being able to un-pimple a subset of the members in the face of
> profiler evidence that inlining is necessary is important. I'm not sure why
> do you say that "my approach" doesn't support that. One possibility is to
> use inheritance in the cpp file:
>
> header:
>
> struct foo { int critical_; };
> shared_ptr<foo> create_foo();
> inline void use_foo_critical( foo * p ) { ++p->critical_; }
> void use_foo_not_so_critical( foo * );
>
>
Yes, it seems I missed this. Thanks!

> OTOH do note that in the header we may leave shared_ptr incomplete and
> still declare a shared_ptr factory function. This leads to extremely lean
> header files:
>
> namespace boost { template <class> class shared_ptr; }
> struct foo;
> boost::shared_ptr<foo> create_foo();
> void use_foo( foo * );
>
> Emil
>

You're making a very compelling argument. Actually strong enough that it
makes me want the uniform call syntax when I was previously on the fence
about that feature.

-- chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk