Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

bit_and Function

A predefined function object that performs the bitwise AND operation (binary operator&) on its arguments.

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

// specialized transparent functor for operator&
template<>
   struct bit_and<void>
   {
      template<class Type1, class Type2>
      auto operator()(Type1&& Left, Type2&& Right) const
         -> decltype(std::forward<Type1>(Left)
            & std::forward<Type2>(Right));
   };
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 AND 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 AND 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.

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

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

Header: <functional>

Namespace: std

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.