【发布时间】:2014-10-13 06:50:13
【问题描述】:
在尝试使用 Boost.Graph 时遇到了一些严重的编译错误。该错误是一种回归,因为它在编译 1.55.0 时不存在。我挖了一点,但无法修复,有人知道这里出了什么问题吗?
注意事项: 使用 -std=c++0x 编译标志
会产生错误的代码。
#include "boost/graph/adjacency_list.hpp"
int main(int argc, char** argv)
{
using boost::adjacency_list;
using boost::vecS;
using boost::directedS;
typedef adjacency_list<vecS, vecS, directedS, boost::default_color_type> Graph;
std::vector< std::pair<int, int> > testVec;
auto graph = Graph( begin(testVec), end(testVec), testVec.size());
return 0;
}
从我的 IDE 复制的错误
/usr/include/c++/4.6/bits/vector.tcc:319:错误:使用已删除 函数'boost::detail::stored_edge_property::self& boost::detail::stored_edge_property::operator=(boost::detail::stored_edge_property::self&&) [with Vertex = long unsigned int, Property = boost::no_property, boost::detail::stored_edge_property::self = boost::detail::stored_edge_property]'
.../boost/boost/graph/detail/adjacency_list.hpp:318: 错误:'boost::detail::stored_edge_property::self& boost::detail::stored_edge_property::operator=(boost::detail::stored_edge_property::self&&) [with Vertex = long unsigned int, Property = boost::no_property, boost::detail::stored_edge_property::self = boost::detail::stored_edge_property]' 被隐式删除,因为默认 定义格式不正确:
.../boost/boost/graph/detail/adjacency_list.hpp:318:错误:基础 ‘boost::detail::stored_edge’ 没有动作 赋值运算符或普通复制赋值运算符
/usr/include/c++/4.6/bits/stl_algobase.h:546:错误:使用已删除 函数'boost::detail::stored_edge_property::self& boost::detail::stored_edge_property::operator=(boost::detail::stored_edge_property::self&&) [with Vertex = long unsigned int, Property = boost::no_property, boost::detail::stored_edge_property::self = boost::detail::stored_edge_property]'
【问题讨论】:
-
您是否查看了 stored_edge 和 adjacency_list.hpp 从 1.55 到 1.56 的差异?答案可能就在里面。
-
不错的主意,我去看看有什么不同。
-
错误登录the boost bug tracker。还要注意的是,g++4.7或4.8不会出现编译错误,这是g++4.6特有的问题。
-
@radman 在 Ubuntu 上使用 gcc 4.8.5 和 boost 1.61 时,我遇到了这个错误。
标签: c++ gcc c++11 boost compiler-errors