|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-13 01:45:56
Robert Ramey wrote:
> Of course you can make the load function a friend
> explicitly.
>
> You argued that this was bothersome and I agreed
> to address it. Now that I've spent some more time
> looking at it - I want to change my mind (again!).
> It turns out that the way I wanted to implement it
> though simple, implies and extra copy of the
> newly constructed item.
That's bad, though I don't know what approach you had in mind, and can't
fully understand why this extra copy was requried.
> This means every one
> would have to pay for it just to address a
> very rare situation. So I want to leave things as they
> are.
>
> My argument is:
>
> a) Making the change would a performance penalty.
> b) The template that invokes the private constructor
> can be declared a friend if necessary.
> c) This situation should be very rare.
>
> My argument for c) above is recounted in
> http://lists.boost.org/MailArchives/boost/msg53056.php
> Basically I argue that if we want to make a constructor
> private - it's to prohibit anyone from creating an invalid
> object. I understand that there can occasions when
> one needs to do this - but I argue that these are very
> rare occasions. On such occasions we can add an
> extra friend declaration.
I think I've said about it many times: I'd like to be able to create private
default ctor to allow the selected crowd of class' friend to create
ininitialized instance. I can't make any futher argument about it.
> I know this is rare occurence for me, If I'm wrong about
> this being a rare occurence in general, it might be
> interesting to know what I'm missing here.
Well, it seems like I'm the only one who reported practical use of your
library, and actually used it in only small fragment. We seems to disagree
about private ctors, and only practice can show if this situation is rare,
or not.
As a temporary solution, I think it would be best if you add an ability to
write
friend class boost::serialization::stl::access;
This has the benefit that I can make my code work with extra line, and that
like is quite clear, as opposed to friend declaration for intertal
function. Other folks can ignore this feature if they don't want it, and
eventually we'll be able to decide what is needed. What do you think?
- Volodya
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk