Policy Idiom
Learn about the C++ idiom policy.
We'll cover the following...
We'll cover the following...
Policy and traits are generally used together. We’ll start with policy, and then move on to discuss traits in the next lesson.
Policy
A policy is a generic function or class whose behavior can be configured. Typically, there are default values for the policy parameters, such as std::vector and std::unordered_map.
Let’s look at the code above. Each container has a default allocated for its elements, depending on the value of T (line 5) or std::pair<const Key, T> (line 8).
Additionally, ...