【发布时间】:2012-07-09 10:17:28
【问题描述】:
我最近声明在程序中使用指针,当我尝试以下操作时,出现此错误。
stored_points.push_back(new Point(anchor_y,anchor_x,last_direction));
错误 C2664: 'void std::vector<_ty>::push_back(_Ty &&)' : 无法使用 [ 将参数 1 从 'Point *' 转换为 'Point &&' _Ty=点 ] 原因:无法从“Point *”转换为“Point” 没有构造函数可以采用源类型,或者构造函数重载决议不明确
我知道使用 new 会返回一个指针,而 .push_back 不能接受这一点,但是,我不知道如何解决这个问题。
【问题讨论】: