|
BDE 4.39.x Production Release
|
Provide a concept for the Standard container-compatible-range.
Provide a concept for the Standard container-compatible-range.
container-compatible-range conceptThis component provides a concept, bslmf::ContainerCompatibleRange, that specifies the requirements for range-types used to create/set containers. This is a concrete concept corresponding the Standard, exposition-only, concept container-compatible-range.
This section illustrates intended use of this component.
Suppose we have a container class that we want to be able to accept content from a range. We can use bslmf::ContainerCompatibleRange concept to constrain the relevant templates, removing them from the overload set unless the (template argument) t_RANGE meets the required constraints.
Notice that the (singular) tag value bsl::from_range is used to clearly direct overload resolution to the range constructor when that is the intent. For other methods, we have the option to incorporate "range" into the method name to avoid ambiguous overloads – i.e., append_range is clearly different from assorted overloads of append (not shown).
Finally, notice that the constraint on t_RANGE and t_TYPE must be repeated in the method definitions: