Skip to content

File operator.h

FileList > detection > operator.h

Go to the source code of this file

Operator detection traits: compile-time aliases and value checks (Detection Idiom) More...

  • #include <scl/utility/preprocessor/forward.h>
  • #include <scl/utility/type_traits/detection.h>
  • #include <scl/utility/type_traits/member_like.h>

Namespaces

Type Name
namespace scl
Root namespace of ScL project.

Macros

Type Name
define SCL_DETAIL_ARGUMENTS_OPERATOR_DETECTION (op, name) /* multi line expression */
define SCL_DETAIL_ARROW_OPERATOR_DETECTION (op, name) /* multi line expression */
define SCL_DETAIL_BINARY_OPERATOR_DETECTION (op, name) /* multi line expression */
define SCL_DETAIL_POSTFIX_UNARY_OPERATOR_DETECTION (op, name)
define SCL_DETAIL_PREFIX_UNARY_OPERATOR_DETECTION (op, name) /* multi line expression */

Detailed Description

This header declares a comprehensive suite of compile-time detection aliases and constexpr values for C++ operators using the Detection Idiom (N4502), implemented with decltype and std::declval.

For each supported operator, the following symbols are provided (expanded via internal macros in the non-Doxygen branch of this header; documented here for Doxygen users):

  • Operation (expression) aliases:
  • name_operation<...>: SFINAE-friendly alias representing the operator expression (built-in or free function).
  • has_name_v<...>: constexpr boolean; true if name_operation<...> is well-formed.
  • name_t<...>: alias to the detected expression type, or scl::nonesuch on failure.

  • Member detection aliases:

  • name_member_operation<Type, ...>: alias representing std::declval<Type>().operator op(...).
  • has_name_member_v<...>: constexpr boolean; true if the member-form expression is well-formed.
  • name_member_t<...>: alias to the detected result type for the member-form expression, or scl::nonesuch.

  • Exact member detection aliases:

  • name_member_exact_operation<Type, ...>: alias using pointer-to-member to require an actual class member with the exact signature implied by the non-exact member operation (including ref-qualifiers via scl::member_function_like_t).
  • has_name_member_exact_v<...>: constexpr boolean; true if the pointer-to-member expression is well-formed.
  • name_member_exact_t<...>: alias to the detected result type for the exact member expression, or scl::nonesuch.

Operators covered: * Prefix unary: & (address_of), * (indirection), + (unary_plus), - (unary_minus), ++ (prefix_increment), -- (prefix_decrement), ~ (bitwise_not), ! (logical_not) * Postfix unary: ++ (postfix_increment), -- (postfix_decrement) * Binary comparisons: == (equal_to), != (not_equal_to), < (less), <= (less_equal), > (greater), >= (greater_equal) * Binary arithmetic/bitwise: * (multiply), / (divide), % (modulo), + (plus), - (minus), << (left_shift), >> (right_shift), & (bitwise_and), | (bitwise_or), ^ (bitwise_xor) * Logical binary: && (logical_and), || (logical_or) * Assignment: = (assign), += (plus_assign), -= (minus_assign), *= (multiply_assign), /= (divide_assign), %= (modulo_assign), <<= (left_shift_assign), >>= (right_shift_assign), &= (bitwise_and_assign), |= (bitwise_or_assign), ^= (bitwise_xor_assign) * Special: ->* (arrow_to_pointer), -> (arrow), , (comma), [] (subscript), () (call)

Implementation notes: * All public symbols live in the scl namespace. * Detection is implemented via alias templates using decltype and std::declval. * Exact member detection uses pointer-to-member and scl::member_function_like_t to enforce exact signature and ref-qualifiers.

Macro Definition Documentation

define SCL_DETAIL_ARGUMENTS_OPERATOR_DETECTION

#define SCL_DETAIL_ARGUMENTS_OPERATOR_DETECTION (
    op,
    name
) `/* multi line expression */`

define SCL_DETAIL_ARROW_OPERATOR_DETECTION

#define SCL_DETAIL_ARROW_OPERATOR_DETECTION (
    op,
    name
) `/* multi line expression */`

define SCL_DETAIL_BINARY_OPERATOR_DETECTION

#define SCL_DETAIL_BINARY_OPERATOR_DETECTION (
    op,
    name
) `/* multi line expression */`

define SCL_DETAIL_POSTFIX_UNARY_OPERATOR_DETECTION

#define SCL_DETAIL_POSTFIX_UNARY_OPERATOR_DETECTION (
    op,
    name
) 

define SCL_DETAIL_PREFIX_UNARY_OPERATOR_DETECTION

#define SCL_DETAIL_PREFIX_UNARY_OPERATOR_DETECTION (
    op,
    name
) `/* multi line expression */`


The documentation for this class was generated from the following file module/utility/src/scl/utility/type_traits/detection/operator.h