Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-08-17 13:03:24

Another reason to use free functions vs member functions:

o) It can reduce compile time dependencies, if you place the free functions
in a separate include file. Then things which require
access to the object include only the definition.h and things which
use the free functions include the objectUtility.h file.

Regarding Jeremy's example if you don't own the interface/code to
Joe::Vector or suzy::vector_add adding a member function is not an option.
i.e. Using third party software. If you go ahead and modify the include
files to joe's vector, whenever you get an update you are required to repeat
this modification. Ick!

The fix by specialization takes care of this. (Also it can be used to
generate a "size" function if none exists at all in Joe::vector)


The issue is a that a class should provide no more member functions than are
necessary. Just what that minimum set is of course open to discussion and
endless debate.



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