BDE 4.14.0 Production release
|
Provide utilities for operating on bdlat
"nullable value" types.
This component provides a utility struct
, bdlat::NullableValueUtil
, which serves as a namespace for a collection of function templates providing derived operations for "nullable value" types. See bdlat_nullablevaluefunctions for the set of requirements of "nullable value" types in the bdlat
framework. See bdlat_typecategory for more general information about this framework.
In order to be "plugged in" to the bdlat
framework as a "nullable value", a type must meet a set of requirements including providing certain function overloads (customization points) and specifying certain type traits, as specified by the bdlat_nullablevaluefunctions component. We call the required function overloads the "primitive" operations of "nullable value" types. This component provides "derived" operations, which are operations that are exclusively defined in terms of primitive operations, and as such can be used with any "nullable value" type.
In this section we show intended usage of this component.
Suppose we would like to define a function that detects whether the value held by a nullable value is an array.
First, we need to define an accessor functor per {bdlat_typecategory |ACCESSOR
Functors} that will be used to detect whether the held value is an array:
Then, we can define a utility struct
, MyNullableValueUtil
, that provides a function for detecting whether or not the held value of a nullable value is an array:
Finally, we can use this utility to detect whether nullable values are arrays: