CGAL::compose_shared

Definition

The function compose_shared is used to compose functors f0,...,fn into each other, thereby creating a new functor f. The first argument f0 always denotes the base functor, for which the remaining functors f1,...,fn provide the arguments. Contrary to the function compose, the arguments of f are not split among f1,...,fn, but instead shared by all the functors. Therefore, all the functors f1,...,fn must have the same arity, which is also the arity of the composed functor f. Two or three functors can be composed into the base functor, giving raise to a functor of arity at most five.

As an example, consider a binary functor f0 and two binary functors f1 and f2. Composing f1 and f2 into f0 yields a new binary functor

f: (x0,x1) f0(f1(x0,x1),f2(x0,x1)).

#include <CGAL/functional.h>

template < class F0, class F1, class F2 >
typename Compose_shared< F0, F1, F2 >::Type
compose_shared ( F0 f0, F1 f1, F2 f2)
returns the functor f0(f1( · ),f2( · )) with the same arity as f1 (and f2).
Requirement: f0 is AdaptableFunctor of arity 2. f1 and f2 are AdaptableFunctors having the same arity.

template < class F0, class F1, class F2, class F3 >
typename Compose_shared< F0, F1, F2, F3 >::Type
compose_shared ( F0 f0, F1 f1, F2 f2, F3 f3)
returns the functor f0(f1( · ),f2( · ),f3( · )) with the same arity as f1 (and f2, f3).
Requirement: f0 is AdaptableFunctor of arity 3. f1, f2, and f3 are AdaptableFunctors having the same arity.

See Also

CGAL::Compose_shared<F0,F1,F2,F3>
CGAL::compose
AdaptableFunctor