Why this is causing C2102: '&' requires l-value

前端 未结 5 1391
无人共我
无人共我 2021-01-02 12:16

I was wondering, why the following way of code (Already commented out) will cause
C2102: \'&\' requires l-value

Is there a better way to avoid u

5条回答
  •  旧时难觅i
    2021-01-02 12:49

    No.

    What address would me contain otherwise? Here you gave it the address of tmp -- but if you replace it with int** me = &aa.get_dummy();, where would it point?

    There's no meaningful answer to that question, so the standard requires that the argument of & be an lvalue.

提交回复
热议问题