柠檬图形库C++;将值映射为函数参数错误 我是一个C++和柠檬的绝对新手,我有以下问题:柠檬图库。我想创建一个函数,它获取一个“map”作为输入变量。大概是这样的: bool augment(Graph &g, Graph::EdgeMap<int> sol_edge) { //do something } bool-augment(图形&g,图形::EdgeMap sol_-edge) { //做点什么 }

柠檬图形库C++;将值映射为函数参数错误 我是一个C++和柠檬的绝对新手,我有以下问题:柠檬图库。我想创建一个函数,它获取一个“map”作为输入变量。大概是这样的: bool augment(Graph &g, Graph::EdgeMap<int> sol_edge) { //do something } bool-augment(图形&g,图形::EdgeMap sol_-edge) { //做点什么 },c++,function,arguments,lemon-graph-library,C++,Function,Arguments,Lemon Graph Library,但是,当我尝试构建它时,会出现以下错误: \lemon-1.3\lemon\bits\vector_map.h|110|error: 'lemon::VectorMap<_Graph, _Item, _Value>::VectorMap(const lemon::VectorMap<_Graph, _Item, _Value>&) [with _Graph = lemon::GraphExtender<lemon::ListGraphBase>; _I

但是,当我尝试构建它时,会出现以下错误:

\lemon-1.3\lemon\bits\vector_map.h|110|error: 'lemon::VectorMap<_Graph, _Item, _Value>::VectorMap(const lemon::VectorMap<_Graph, _Item, _Value>&) [with _Graph = lemon::GraphExtender<lemon::ListGraphBase>; _Item = lemon::ListGraphBase::Node; _Value = bool; lemon::VectorMap<_Graph, _Item, _Value> = lemon::VectorMap<lemon::GraphExtender<lemon::ListGraphBase>, lemon::ListGraphBase::Node, bool>]' is private|
\lemon-1.3\lemon\bits\vector\u map.h | 110 |错误:“lemon::VectorMap::VectorMap(const lemon::VectorMap&)[with _Graph=lemon::graphXtender;_Item=lemon::ListGraphBase::Node;_Value=bool;lemon::VectorMap=lemon::VectorMap]”是私有的|
这是否意味着不可能创建带有映射类型参数的函数


谢谢你的帮助

您必须通过引用传递它:

bool augment(ListGraph& g, ListGraph::EdgeMap<int>& sol_edge)    {
    //do something
}
bool-augment(ListGraph&g,ListGraph::EdgeMap&solu-edge){
//做点什么
}