'Variadic template unpacked in a lambda [duplicate]

How can I complete the code in the lambda:

template<typename ... Args>
    requires conjunction_v<is_same<remove_cvref_t<Args>, HANDLE> ...>
void waitForMultipleObjects( BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable, Args ... args )
{
    if( sizeof ... (Args) > MAXIMUM_WAIT_OBJECTS )
        throw invalid_argument( "waitForMultipleObjects() - number of handles > MAXIMUM_WAIT_OBJECTS" );
    HANDLE ah[MAXIMUM_WAIT_OBJECTS];
    [&]<size_t ... Is>( index_sequence<Is ...> iseq, tuple<Args ...> handles )
    {
        //(ah[Is] = get<Is>( handles )), ...;
    }( make_index_sequence<sizeof ... (Args)>, make_tuple( Args ... ) );
    DWORD dwWait = WaitForMultipleObjectsEx( sizeof ... (Args), ah, bWaitAll, dwMilliseconds, bAlertable );
    if( dwWait <= WAIT_OBJECT_0 || dwWait >= WAIT_OBJECT_0 + sizeof ... (Args) )
        throw system_error( GetLastError(), system_category(), "WaitForMultipleObjectsEx() failed" );
}


Solution 1:[1]

You need extra parenthesis:

((ah[Is] = get<Is>( handles )), ...);

fold expression has parenthesis around the expression.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jarod42