##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::function

From cppreference.com
< cpp‎ | experimental

Defined in header `<experimental/functional>` |  |
template< class > class function; /* undefined */ |  | (library fundamentals TS)
template< class R, class... Args > class function<R(Args...)> |  | (library fundamentals TS)

`std::experimental::function` is a modified version of std::function with support for type-erased allocators.

### [edit] Member types

Type | Definition
`allocator_type` | std::experimental::erased_type

### [edit] Member functions

(constructor) | constructs a new `std::experimental::function` instance (public member function) [edit]
operator= | assigns a new target (public member function) [edit]
swap | swaps the contents (public member function) [edit]
get_memory_resource | retrieves a pointer to the memory resource used by this object to allocate memory (public member function) [edit]

### [edit] Non-member functions

std::experimental::swap(std::experimental::function) | specializes the `swap` algorithm (function template) [edit]
operator==operator!= | compares an std::experimental::function with nullptr (function template) [edit]

### [edit] Helper classes

std::uses_allocator<std::experimental::function> | specializes the std::uses_allocator type trait (class template specialization) [edit]

## Members identical to std::function

### Member types

Type | Definition
`result_type` | `R`
`argument_type` | `T` if sizeof...(Args)==1 and `T` is the first and only type in `Args...`
`first_argument_type` | `T1` if sizeof...(Args)==2 and `T1` is the first of the two types in `Args...`
`second_argument_type` | `T2` if sizeof...(Args)==2 and `T2` is the second of the two types in `Args...`

### Member functions

(destructor) | destroys a `std::function` instance (public member function of `std::function`) [edit]
operator bool | checks if a valid target is contained (public member function of `std::function`) [edit]
operator() | invokes the target (public member function of `std::function`) [edit]
##### Target access
target_type | obtains the typeid of the stored target (public member function of `std::function`) [edit]
target | obtains a pointer to the stored target (public member function of `std::function`) [edit]

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