Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-08-17 12:23:05


--- In boost_at_[hidden], jsiek_at_l... wrote:
>
> It seems to me your argument is mostly about how std::string should
> have been defined, which is a side issue. To argue directly against
my
> point you need to list reasons for using member functions instead of
> free functions.

Polymorphism. Access to internal state (and most or all of the state
should be internal). If you've coded a member function that only
calls other public member functions you've probably found something
that shouldn't have been a member function.

The latest topic to have brought this issue up was the wait function
for our CV. To make it free standing will require either exposing
state information publicly that should not be exposed, or (ab)using
friend functions. Making a wait method free standing by using friend
doesn't resolve your original issue since other interfaces won't have
the luxury of being friends. If all they do is wrap the other free
standing wait function then there was no benefit gained from it being
free standing in the first place, since you could have just as easily
wrapped the member function with the same free standing wrapper.

William Kempf


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