我在 Lemon Graph Library 中创建了一个图表并添加了节点和转换
typedef ListDigraph Graph;
vector<Graph> Process;
for(temp = temp.child("role");temp;temp = temp.next_sibling("role"))
{
Graph proc;
for(xml_node temp1 = temp.child("states").child("state");temp1;temp1 = temp1.next_sibling())
{
string state = temp1.child_value();
state = role + "_" + state;
vertex = process.addNode();
state_name[vertex] = state;
}
Process.push_back(proc);
}
如果我不将它推入矢量一切正常,但是当我尝试将其推入时Process
会出错。错误是 70-80 行长,但我发现的要点是:
/usr/local/include/lemon/list_graph.h:336:5: error:
lemon::ListDigraph::ListDigraph(const lemon::ListDigraph&) is private
在做了@Magtheridon96 建议后得到以下错误:
In file included from /usr/include/c++/4.6/i686-linux-gnu/./bits/c++allocator.h:34:0,
from /usr/include/c++/4.6/bits/allocator.h:48,
from /usr/include/c++/4.6/string:43,
from /usr/include/c++/4.6/bits/locale_classes.h:42,
from /usr/include/c++/4.6/bits/ios_base.h:43,
from /usr/include/c++/4.6/ios:43,
from /usr/include/c++/4.6/ostream:40,
from /usr/include/c++/4.6/iostream:40,
from usingleda.cpp:1:
/usr/include/c++/4.6/ext/new_allocator.h: In member function ‘void __gnu_cxx::new_allocator<_Tp>::construct(__gnu_cxx::new_allocator<_Tp>::pointer, _Args&& ...) [with _Args = {std::unique_ptr<lemon::ListDigraph>&}, _Tp = std::unique_ptr<lemon::ListDigraph>, __gnu_cxx::new_allocator<_Tp>::pointer = std::unique_ptr<lemon::ListDigraph>*]’:
/usr/include/c++/4.6/bits/vector.tcc:97:6: instantiated from ‘void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::unique_ptr<lemon::ListDigraph>&}, _Tp = std::unique_ptr<lemon::ListDigraph>, _Alloc = std::allocator<std::unique_ptr<lemon::ListDigraph> >]’
usingleda.cpp:134:43: instantiated from here
/usr/include/c++/4.6/ext/new_allocator.h:114:4: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = lemon::ListDigraph, _Dp = std::default_delete<lemon::ListDigraph>, std::unique_ptr<_Tp, _Dp> = std::unique_ptr<lemon::ListDigraph>]’
/usr/include/c++/4.6/bits/unique_ptr.h:256:7: error: declared here
In file included from /usr/include/c++/4.6/vector:70:0,
from /usr/local/include/lemon/core.h:22,
from /usr/local/include/lemon/list_graph.h:26,
from usingleda.cpp:3:
/usr/include/c++/4.6/bits/vector.tcc: In member function ‘void std::vector<_Tp, _Alloc>::_M_insert_aux(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {std::unique_ptr<lemon::ListDigraph>&}, _Tp = std::unique_ptr<lemon::ListDigraph>, _Alloc = std::allocator<std::unique_ptr<lemon::ListDigraph> >, std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<std::unique_ptr<lemon::ListDigraph>*, std::vector<std::unique_ptr<lemon::ListDigraph> > >, typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer = std::unique_ptr<lemon::ListDigraph>*]’:
/usr/include/c++/4.6/bits/vector.tcc:102:4: instantiated from ‘void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::unique_ptr<lemon::ListDigraph>&}, _Tp = std::unique_ptr<lemon::ListDigraph>, _Alloc = std::allocator<std::unique_ptr<lemon::ListDigraph> >]’
usingleda.cpp:134:43: instantiated from here
/usr/include/c++/4.6/bits/vector.tcc:319:4: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = lemon::ListDigraph, _Dp = std::default_delete<lemon::ListDigraph>, std::unique_ptr<_Tp, _Dp> = std::unique_ptr<lemon::ListDigraph>]’
/usr/include/c++/4.6/bits/unique_ptr.h:256:7: error: declared here