我有以下课程
文件Node.c
std :: vector<NodeConnection*>* Node :: GetConnections() const
{
const std :: vector <NodeConnection*> * output = &this->connections;
return output;
}
文件Node.h
class Node {
private:
std :: vector <NodeConnection*> connections;
public:
std :: vector <NodeConnection*>* GetConnections() const;
};
我正在尝试将其转换vector connections
为 const 指针。但是,我不断收到错误
[Error] invalid conversion from 'const std::vector<NodeConnection*>*' to 'std::vector<NodeConnection*>*' [-fpremissive]
我将如何将其转换为可以返回的常量指针?