C++ Logo

std-proposals

Advanced search

[std-proposals] Invoke callee with caller's arguments [forward]

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 15 Jan 2026 10:54:15 +0000
Let's say we were to have code such as the following:

  __uint128_t RegisterPerson( chrono::time_point date_of_birth,
string_view surname, string_view forename )
    {
        auto id = FindEntity( date_of_birth, surname, forename );
        if ( id ) return id;
        id = NewEntity( date_of_birth, surname, forename );
        AddPerson(id);
        return id;
    }

Would it be convenient if we could just write:

  __uint128_t RegisterPerson( chrono::time_point date_of_birth,
string_view surname, string_view forename )
    {
        auto id = FindEntity( [forward] );
        if ( id ) return id;
        id = NewEntity( [forward] );
        AddPerson(id);
        return id;
    }

If you were to use this feature inside a template function, all of the
forwarding-reference arguments would have 'std::forward' applied to
them.

Received on 2026-01-15 10:54:29