Partager via


bit_not Function

A predefined function object that performs the bitwise complement (NOT) operation (unary operator~) on its argument.

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

// specialized transparent functor for operator~
template<> 
   struct bit_not<void> 
   {
      template<class Type>
      auto operator()(Type&& Right) const 
         -> decltype(~std::forward<Type>(Right));
   };

Parameters

  • Type
    A type that supports a unary operator~.

  • Right
    The operand of the bitwise complement operation. The unspecialized template takes an lvalue reference argument of type Type. The specialized template does perfect forwarding of an lvalue or rvalue reference argument of inferred type Type.

Return Value

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

Remarks

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

Requirements

Header: <functional>

Namespace: std

See Also

Reference

<functional>

Lvalues and Rvalues

Standard Template Library