not operator

not operator Logical negation operator

unary-expr := ! cast-expr | not cast-expr

The not operator converts its operand to type bool, inverts its value, and returns a bool result. The not keyword is interchangeable with the ! token.

Example

template<typename C>

typename C::value_type checked_first(const C& c)

{

  if (not c.empty(  ))

    return c[0];

  throw std::out_of_range("container is empty");

}

See Also

and, bool, expression, or, Chapter 3, <ciso646>