Šimon Tóth’s Post

View profile for Šimon Tóth

C++ Educational Content Creator | 20 years of Software Engineering experience distilled into digestible daily posts

The std::shared_future is a C++11 synchronization tool suitable for one-shot single-producer/many-consumers situations. Unlike std::future, std::shared_future is copyable, allowing multiple instances of std::shared_future to refer to the same shared state. Similar to std::future, std::shared_future<void> can be used for signalling. Compiler Explorer link: https://lnkd.in/eGRbm94q #cpp #cplusplus #coding #programming #dailybiteofcpp

  • text
Scott Jones

HiArc4K followers

2y

What’s the difference between a shared_future<T> and a shared_ptr<future<T>> ? Based on your example it seems like it’s a type alias. If you pass promise.get_future() into the shared_ptr ctor, it should work the same?

Alireza Nikpay

Freelance1K followers

2y

Does we have some mechanisms like promise/future but not getting invalid future after one set_value for the promise? Something like set the promise calue multiple time and also get the future multiple times? (I think we can get that using condition variable and notify function, but is it possible via promise/future?)

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories