Search⌘ K

Idioms and Patterns: Policy and Traits

Explore how policy and traits idioms in C++ templates provide adaptable behavior and extract type characteristics. Understand their use in standard containers and generic programming to enhance design flexibility and code reuse.

We'll cover the following...

Policy and Traits

Policy

A Policy is a generic function or class with adaptable behavior.

Policy parameters have typically default values.

This adaptable behavior is expressed in several type parameters, the so-called policy parameters. Due to different policy parameters, the concrete generic function or class behaves differently.

Typical ...