Consider adding structured binding support to futures

Issue #571 wontfix
Dan Bonachea created an issue

Split off from documentation issue #469:

The C++ standard specifies that structured bindings can use get<i>(e), found by ADL, to enable structured bindings for a custom class. By providing this function in the upcxx namespace for upcxx::future or as a hidden friend in upcxx::future, we can enable this functionality for UPC++ futures.

upcxx::future<int,double> fut = /* ... */;
auto [a,b] = fut;

Comments (1)

  1. Dan Bonachea reporter

    In the 2023-02-21 meeting discussion, we decided not to pursue this idea, which seems likely to degrade readability (e.g. result vs wait), and at best just saves a few characters of typing relative to calling the appropriate wait* or result* member function on the fut object (the best choice depends on the synchronization state and whether the caller wants the new variables a,b to be const references or copies).

  2. Log in to comment