【发布时间】:2017-02-21 11:55:59
【问题描述】:
所以我得到的错误是:
error: no matching function for call to 'std::vector<Type*>::push_back(AnimationAutoComplete::Type*&)'
neighbours.push_back(samplePoint);
^
我制作了一个精简版项目来重现该错误。
这是我的AnimationAutoComplete.h
#include <vector>
class Type;
typedef std::vector<Type *> SetOfConstTQ;
class AnimationAutoComplete {
public:
AnimationAutoComplete() {}
~AnimationAutoComplete() {}
SetOfConstTQ getNeighbours();
class Type
{
public:
Type() {}
const double point = 3.0;
};
};
还有我的main.cpp
#include "AnimationAutoComplete.h"
SetOfConstTQ AnimationAutoComplete::getNeighbours()
{
SetOfConstTQ neighbours;
Type *samplePoint = new Type();
neighbours.push_back(samplePoint);
return neighbours;
}
int main()
{
AnimationAutoComplete main;
}
【问题讨论】:
-
::Type不是::Whatever::Type。
标签: c++ pointers vector reference