std::promise
has a constructor that allocates the memory used to store the general state. In the implementations .then
that I have seen so far, one stores the function in an erasable form, similar std::function
in general condition. The concurrency stlab library even goes so far as to put
using then_t = std::vector<std::pair<executor_t, task<void()>>>;
into a shared state (to enable shared futures).
Is there an intention to indicate whether a distributor can be specified to continue?
In P0443R3 they say in 1.2.9 Properties for setting memory allocation
Implementer implementations must use the provided allocator to allocate any memory needed to store the presented functional object.
I think this means that the repository for agents represented through functions execute
is not a pointer in the std::future
shared state .
I reviewed recent offers for futures or performers, and I could not find anything. Recent publications seem to help performers in the overall state of the future anyway. If an artist has an appropriate custom allocator, should this be used?
It seems to me that I missed something.
-
: , , , . - , :
template <typename Executor, typename T>
struct shared_state_t {
std::atomic<unsigned> flags;
std::variant<std::exception_ptr, T> maybe_value;
continuation_t<Executor, T> continuation;
};
continuation_t<Executor, T>
. Executor
- std::function<void(T&&)>
.