BloombergLP::bdlat::NullableValueUtil::accessValueByCategory

Invoke a categorized accessor on the value held by a nullable object.

Synopsis

Declared in <bdlat_nullablevalueutil.h>

template<
    class TYPE,
    class ACCESSOR>
static
int
accessValueByCategory(
    TYPE const& object,
    ACCESSOR& accessor);

Description

Invoke the specified accessor on the non-modifiable value stored in the specified "nullable" object and on a prvalue of the category tag type for the dynamic category of the value. See {bdlat_typecategory|Category Tags and Enumerators} for documentation about category tags. Return the value from the invocation of accessor. The accessor must be an accessor functor. See {bdlat_typecategory|ACCESSOR Functors} for the requirements on accessor. The behavior is undefined if object contains a null value.

Return Value

value from the invocation of accessor

Parameters

NameDescription
object"nullable" object whose held value is accessed
accessorfunctor applied to the held value with a category tag