CGAL 5.5.5 - CGAL and the Boost Graph Library
|
The algorithms of the Boost Graph Library (BGL) often have many parameters with default values that are appropriate for most cases.
In general, when no special treatment is applied, the values of such parameters are passed as a sequence. Deviating from the default for a certain parameter requires the user to explicitly pass values for all preceding parameters. The solution to this problem is to first write a tag and then the parameter, which for Dijkstra's shortest path algorithm might look as follows:
In the BGL manual, this is called named parameters. The named parameters in the snippet use the tags predecessor_map
and distance_map
and they are concatenated using the dot operator.
A similar mechanism was introduced in CGAL, with the small difference that the named parameters tag live in the CGAL::parameters::
namespace and CGAL::parameters::default_values()
can be used to indicate that default values of optional named parameters must be used. As in the BGL, named parameters in CGAL are also concatenated using the dot operator, and a typical usage is thus: