std::experimental::not_fn - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::not_fn

From cppreference.com
< cpp‎ | experimental

Defined in header `<experimental/functional>` |  |
template< class F> /*unspecified*/ not_fn( F&& f ); |  | (library fundamentals TS v2)

Creates a forwarding call wrapper that returns the complement of the callable object it holds.

### [edit] Parameters

f | - | the object from which the `Callable` object held by the wrapper is constructed

### [edit] Return value

Let `FD` be std::decay_t<F> and `fd` be an lvalue of type `FD` constructed from std::forward<F>(f).

`not_fn` returns a forwarding call wrapper `fn` of unspecified type such that fn(a1, a2, ..., aN) is equivalent to !INVOKE(fd, a1, ..., aN), where `INVOKE` is the operation described in `Callable`.

The returned call wrapper is always `MoveConstructible`, and is `CopyConstructible` if FD is `CopyConstructible`.

### [edit] Remarks

If `fd` is not `Callable`, or std::is_constructible<FD, F>::value is not `true`, the behavior is undefined.

### [edit] Exceptions

Throws no exceptions, unless the construction of `fd` throws.

### [edit] Notes

`not_fn` is intended to replace the C++03-era negators std::not1 and std::not2.

### [edit] See also

unary_negate | wrapper function object returning the complement of the unary predicate it holds (class template) [edit]
binary_negate | wrapper function object returning the complement of the binary predicate it holds (class template) [edit]
not1 | constructs custom std::unary_negate object (function template) [edit]
not2 | constructs custom std::binary_negate object (function template) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/not_fn&oldid=79366"