次の方法で共有


bit_or Function

A predefined function object that performs the bitwise OR operation (operator|) on its arguments.

template<class Type = void>
   struct bit_or : public binary_function< Type, Type, Type > {
      Type operator()(
         const Type& Left, 
         const Type& Right
      ) const;
   };

// specialized transparent functor for operator|
template<>
   struct bit_or<void>
   {
      template<class Type1, class Type2>
      auto operator()(Type1&& Left, Type2&& Right) const
         -> decltype(std::forward<Type1>(Left)
            | std::forward<Type2>(Right));
   };

Parameters

  • Type, Type1, Type2
    Any type that supports an operator| that takes operands of the specified or inferred types.

  • Left
    The left operand of the bitwise OR operation. The unspecialized template takes an lvalue reference argument of type Type. The specialized template does perfect forwarding of lvalue and rvalue reference arguments of inferred type Type1.

  • Right
    The right operand of the bitwise OR operation. The unspecialized template takes an lvalue reference argument of type Type. The specialized template does perfect forwarding of lvalue and rvalue reference arguments of inferred type Type2.

Return Value

The result of Left|Right. The specialized template does perfect forwarding of the result, which has the type that's returned by operator|.

Remarks

The bit_or functor is restricted to integral types for the basic data types, or to user-defined types that implement operator|.

Requirements

Header: <functional>

Namespace: std

See Also

Reference

<functional>

Lvalues and Rvalues

Standard Template Library