Boost logo

Boost :

From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-08-17 11:16:18

--- jsiek_at_[hidden] schrieb: >
> Oh, and one other important advantage of free functions that I left
> out.

This is probably still not the end of the story but having just added
a data member to my 'std::ios_base' implementation I had several
minutes time to think about more advantages of free functions :-) Put
differently, adding free functions does not require recompilation of
all modules dependent on some entity like member functions do (well,
strictly you could avoid the recompilation if you just add a
non-virtual member function on most systems but typically when playing
such tricks other things break easily).

I can see only two reasons to use member functions:

- obviously, dynamic dispatch requires member functions somewhere
- access to protected members is easiest provided with members

When using free functions as the public interface to a class only, both
cases are trivially dealt with a simple forwarding function.


Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.

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