
Julio M. Merino Vidal wrote:
Hello everybody,
At the moment, some objects in the preliminary Boost.Process library are only constructed internally by the library. Examples of these include 'status' instances, created by calls to 'child::wait', and instances of 'child', created by 'launcher::start'. This is currently done by declaring friendship among the related classes (well, not exactly, but almost).
I believe this is suboptimal because it prevents extensibility. Consider a user that wants to create his own Launcher implementation.
What would be the motivation for providing this?
His code is required to return a new 'child' object. But, oh! He cannot currently create it because the constructor is private and his launcher class is not a friend of the provided 'child'. Of course, he could implement his own 'child' -- and in turn implement his own 'status'. Ouch.
...snip details...
I'm open to other suggestions.
I guess my thought is that if you want extensibility, just make the constructors public and move on. That's the cleanest and easiest way... HTH, Jeff