.. _fork_tuple_clang:

tmc::fork_tuple_clang()
------------------------------------------------------------------------------------------------
``tmc::fork_tuple_clang()`` is a HALO-optimized version of ``spawn_tuple().fork()`` that uses the ``[[clang::coro_await_elidable_argument]]`` attribute when compiled with Clang 20+.

For HALO to work, ``fork_tuple_clang()`` must be awaited directly as a prvalue in a ``co_await`` expression. Storing the result in a variable before awaiting prevents HALO from being applied.

.. code-block:: cpp

   // HALO: fork_tuple_clang() is directly awaited
   auto forked = co_await tmc::fork_tuple_clang(task_int(10), task_int(20), task_int(30));
   auto results = co_await std::move(forked);

   // Non-HALO: fork_tuple_clang() stored in variable
   auto dummy = tmc::fork_tuple_clang(task_int(11), task_int(21), task_int(31));
   auto forked = co_await std::move(dummy);
   auto results = co_await std::move(forked);

   // Non-HALO equivalent: spawn_tuple().fork() - due to member function
   // call, this cannot be elided
   auto forked = tmc::spawn_tuple(task_int(12), task_int(22), task_int(32)).fork();
   auto results = co_await std::move(forked);

Main Documentation
------------------------------------------------------------------------------------------------
For the non-HALO version, see :literal_ref:`tmc::spawn_tuple()<spawn_tuple>`.

API Reference
------------------------------------------------------------------------------------------------
.. doxygenfunction:: tmc::fork_tuple_clang(Awaitable&&... Awaitables)
