Suppose the following policy classes that take care of one aspect of the algorithm:
struct VoidF { static void f() { ...
The BoolF policy is "improving": when BoolF :: f () returns true , the algorithm may exit. VoidF is a "minor improvement", so it returns void (I don't want to force a user of my library to return bool when that means nothing to him).
Currently, the algorithm is written as follows:
template <typename F> struct Algorithm { void run() { ...
Of course, this does not work if the Algorithm is created using VoidF . Is there a way to fix this so that there is no branching in the Algorithm<VoidF>::run() as pointed out by the comment?
source share