1

What is the type of "univ" in the code below?

template<typename T>
void func(T&& univ) {
    // ??
}

int sum(int a, int b) {
 return a+b;   
}

int main() {

    func(sum);

}

I didn't know that universal references also worked with functions. Is func(sum); equivalent to func(&sum); or is the rvalue reference binding itself to something else than a simple pointer?

Albert
  • 1,085
  • 2
  • 10
  • 20

1 Answers1

0

I don't really know how to put this into more words...

The type is reference to function taking two ints and returning and int

or, as a comment says: int(&)(int, int)

RamblingMad
  • 5,332
  • 2
  • 24
  • 48