BloombergLP::bslmf::operator,

Detect non-void expressions via an overloaded comma operator.

Synopsis

Declared in <bslmf_invokeresult.h>

template<class t_TYPE>
Tag<false>
operator,(
    t_TYPE const& value,
    InvokeResult_VoidChecker checker)
requires !bsl::is_void<t_TYPE>::value;

Description

Return InvokeResult_VoidChecker() if the left argument is of type cv-void; otherwise bslmf::Tag<false>(). This overload of the comma operator is declared but not defined, and is intended to be used in metafunctions in an unevaluated context to detect void expressions. For any non-void expression expr, (expr,InvokeResult_VoidChecker()), will match this overload and produce a result of type bslmf::Tag<false>. However, const t_TYPE& will not match void, so if expr is a void expression, the built-in comma operator is matched and the result will have type InvokeResult_VoidChecker (i.e., the second argument).

Note that Sun CC incorrectly matches this overload for a void expression, then fails hard. The enable_if prevents this match for Sun CC and any other compilers that may similarly match void and is harmless for compilers that don't.

Return Value

Tag<false> indicating a non-void left-hand operand

Parameters

NameDescription
valuenon-void left-hand operand of the comma expression
checkerright-hand void-detection tag