How do I pass a defined in a concept reference to a template function?

  c++

I have a function:

template<std::same_as<int&> T>
void f(T value) {}

Compiler gives me an error that I don’t have a function with these arguments f(int) if I call it like this:

void g() {
    int a;
    int& b = a;
    f(b);
}

Why does the compiler assume that I use a regular type and not a reference and is there something I can do about it?

Source: Windows Questions C++

LEAVE A COMMENT