1 year ago

#385441

test-img

Bonita Montero

How to make a templated parameter to match the function-signature of an outer templated type

Imagine I've got sth. like this:

template<typename Signature>
struct Callable
{
    template<typename FnType>
        requires std::convertible_to<std::invoke_result_t<FnType>, std::invoke_result_t<Signature>> && ***
    Callable( FnType fn );
    template<typename ... Args>
        requires ***
    std::invoke_result_t<Signature> operator ()( Args &&... args );
};

Signature is a function-type, i.e. f.e. <int( int, string )>. How do I complete the above ***'ed concepts so that I check that either that FnType has an calling operator whose parameters match the parameters of Signature or that the args match the parameters of Signature ?

c++

c++20

0 Answers

Your Answer

Accepted video resources