Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Thunk Class Reference
A Thunk is a container holding any kind of nullary callable. More...
#include <Thunk.h>
Public Member Functions | |
| Thunk () | |
| Thunk Empty constructor. | |
| template<typename F > | |
| Thunk (const F &f) | |
| Construct a Thunk from a nullary callable of type F. | |
| Thunk (void(*f)()) | |
| Special constructor for pointer to function. | |
| Thunk (const Thunk &other) | |
| Copy construction of a thunk. | |
| ~Thunk () | |
| Destruction of the Thunk correctly call the destructor of the inner callable. | |
| Thunk & | operator= (const Thunk &other) |
| Copy assignement from another thunk. | |
| void | operator() () const |
| Call operator. | |
Detailed Description
A Thunk is a container holding any kind of nullary callable.
It wrap value semantic and function call operations of the inner callable held.
- Note:
- Thunk of callable bound to arguments should be generated by the function make_thunk.
Definition at line 38 of file Thunk.h.
Constructor & Destructor Documentation
| Thunk | ( | ) |
Thunk Empty constructor.
Thunk empty constructor Implementation.
When this thunk is called, if does nothing.
Due to the way templates and forwarding work in C++, it was not possible to provide this implementation in Thunk.h
Definition at line 56 of file Thunk.impl.h.
| Thunk | ( | const F & | f ) |
Construct a Thunk from a nullary callable of type F.
Thunk constructor Implementation.
When the call operator is invoked, it call a copy of f ( f() ).
Due to the way templates and forwarding work in C++, it was not possible to provide this implementation in Thunk.h
Definition at line 31 of file Thunk.impl.h.
| Thunk | ( | void(*)() | f ) |
Special constructor for pointer to function.
Specialization for function pointers.
Allow references to functions to gracefully decay into pointer to function. Otherwise, reference to function are not copy constructible (their is no constructible function type in C++). When the call operator is invoked, it call a copy of f ( f() ).
This overload will be chosen when the tyope in input is a reference to a function.
- Parameters:
-
f The function to transform in Thunk.
Definition at line 43 of file Thunk.impl.h.
| ~Thunk | ( | ) |
Member Function Documentation
| void operator() | ( | ) | const |
Generated on Thu Jul 14 2022 09:28:19 by
1.7.2