proomt

Search

Search posts, papers, and topics

exception safety

RSS
  1. 1

    std::call_once vs. std::async

    Raymond Chen compares using std::call_once versus std::async (deferred) for lazy initialization in C++. He shows that std::async can be wrapped in a shared_future for repeatable get() calls, but it adds heap allocation and extra code, while call_once is tiny; exception behavior also differs.

    Raymond Chenmicrosoft.com2 min