\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.14.2 - Profiling tools, Hash Map, Union-find, Modifiers
CGAL::Modifier_base< R > Class Template Reference

#include <CGAL/Modifier_base.h>

Definition

Modifier_base is an abstract base class providing the interface for any modifier.

A modifier is a function object derived from Modifier_base that implements the pure virtual member function operator(), which accepts a single reference parameter R& on which the modifier is allowed to work. R is the type of the internal representation that is to be modified.

Example

The following fragment defines a class A with an internal representation i of type int. It provides a member function delegate(), which gives a modifier access to the internal variable and checks validity thereafter. The example modifier sets the internal variable to 42. The example function applies the modifier to an instance of class A.

class A {
int i; // protected internal representation
public:
void delegate( CGAL::Modifier_base<int>& modifier) {
modifier(i);
CGAL_postcondition( i > 0); // check validity
}
};
struct Modifier : public CGAL::Modifier_base<int> {
void operator()( int& rep) { rep = 42;}
};
void use_it() {
A a;
Modifier m;
a.delegate(m); // a.i == 42 and A has checked that A::i > 0.
}

Types

typedef R Representation
 the internal representation type.
 

Operations

virtual void operator() (R &rep)
 

Member Function Documentation

◆ operator()()

template<typename R>
virtual void CGAL::Modifier_base< R >::operator() ( R &  rep)
virtual
Postcondition
rep is a valid representation.