In C++11, how can I get a temporary lvalue without a name?

后端 未结 3 1310
慢半拍i
慢半拍i 2021-01-01 16:12

I have a traditional C lib and a function (setsockopts) wants an argument by pointer. In C++11 (gcc 4.8), can I pass this argument without initializing a named

3条回答
  •  情话喂你
    2021-01-01 16:40

    You can bind a const reference to a temporary:

    cout << deref(addressof(42)) << endl;
    

提交回复
热议问题