我有以下结构
struct foo{
vector<foo*> cntns;
};
和以下功能
void createLink(foo *i1, foo *i2){
i1->cntns.push_back(i2);
i2->cntns.push_back(i1);
}
但我得到了错误
2 IntelliSense: no instance of overloaded function "std::vector<_Ty, _Alloc>::push_back [with _Ty=foo*, _Alloc=std::allocator<foo*>]" matches the argument list
argument types are: (foo*)
object type is: std::vector<foo*, std::allocator<foo*>>
代码似乎编译得很好,有人知道为什么会这样吗?