c++ - 为什么使用显式模板参数调用 std::make_tuple() 会导致“无法将 'T*&&' 类型的右值引用绑定到 'T*' 类型的左值”错误?
问题描述
为什么我们在显式提供如下模板参数时会收到错误消息?
#include <tuple>
int main()
{
int a = 1;
int* ap = &a;
// std::make_tuple<int*, int>(ap, a); // cause error "cannot bind rvalue reference of type 'int*&&' to lvalue of type 'int*'
std::make_tuple(ap, a); // fine
}
解决方案
推荐阅读
- javascript - JavaScript 不会等到 python 执行完成
- bootstrap-4 - bootstrap-table (wenzhixin) 通过服务器的表格分页不起作用
- r - 关闭 candisc 图中的术语标签
- mysql - 为什么我在这里收到 OUTPUT 子句错误?
- javascript - 如何处理 Sails JS 返回的验证消息?
- typescript - 创建引用自身的类型/接口
- reactjs - React-i18next 悬念
- php - Laravel 将 `id` 更改为 `AUTO_INCREMENT`
- laravel - Laravel 分页有问题
- python - conda install packages for all user error 通道不可访问或无效