C ++ function parameter as a reference

I have a question. Can someone tell me why someone will declare a parameter rthis way?

What is the difference between Record & r and Record (& r)?

QDataStream& operator>>(QDataStream &s, Record(&r))
{
}

Thank:)

+3
source share
2 answers

Record(&r)and Record &rare identical type declarations. I don’t know why someone will include parentheses other than stylistic reasons. Maybe it's a little cool left over from refactoring?

+11
source

, Record (& r) Record & r . , . Record & r Record & r, . , (& r), , . , Record (& r)() r , ​​ .

Record f() { }
0

Source: https://habr.com/ru/post/1765679/


All Articles