【问题标题】:Lemon Graph Library C++ Map values as function arguments errorLemon Graph Library C++ Map values as function arguments error
【发布时间】:2013-12-06 23:28:26
【问题描述】:

我是 C++ 和 Lemon 的绝对新手,我对柠檬图形库有以下问题。我想创建一个函数,将“地图”作为输入变量。像这样的:

bool augment(Graph &g, Graph::EdgeMap<int> sol_edge)
   {
     //do something
   }

但是当我尝试构建它时,我收到以下错误:

\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|

这是否意味着无法创建带有映射类型参数的函数?

感谢您的任何帮助!

【问题讨论】:

    标签: c++ function arguments lemon-graph-library


    【解决方案1】:

    你必须通过引用传递它:

    bool augment(ListGraph& g, ListGraph::EdgeMap<int>& sol_edge)    {
        //do something
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多