C++ 什么';BGL中的裂缝发生了什么?
我正在使用Boost 1.60C++ 什么';BGL中的裂缝发生了什么?,c++,c++11,boost,boost-graph,C++,C++11,Boost,Boost Graph,我正在使用Boost 1.60邻接列表,并希望对模板参数OutEdgeList使用slistS: using Graph = boost::adjacency_list< boost::slistS, boost::listS, boost::bidirectionalS >; #if !defined BOOST_NO_SLIST # ifdef BOOST_SLIST_HEADER # include BOO
邻接列表
,并希望对模板参数OutEdgeList
使用slistS
:
using Graph = boost::adjacency_list<
boost::slistS, boost::listS, boost::bidirectionalS
>;
#if !defined BOOST_NO_SLIST
# ifdef BOOST_SLIST_HEADER
# include BOOST_SLIST_HEADER
# else
# include <slist>
# endif
#endif
#if !defined BOOST_NO_SLIST
struct slistS {};
#endif
对于
boost::slistS
,是否不能使用std::forward\u list
?如果没有,是否有计划在BGL的未来版本中包含此内容?我认为这是针对缺少
的Clang/Libc++的。它不是C++标准的一部分。
使用GCC/libstdc++进行编译很好(使用gcc5.2和c++14进行测试)
所以我只使用boost::container::slist
:
using Graph = boost::adjacency_list<
boost::slistS, boost::listS, boost::bidirectionalS
>;
#if !defined BOOST_NO_SLIST
# ifdef BOOST_SLIST_HEADER
# include BOOST_SLIST_HEADER
# else
# include <slist>
# endif
#endif
#if !defined BOOST_NO_SLIST
struct slistS {};
#endif
#include <boost/container/slist.hpp>
#include <boost/graph/adjacency_list.hpp>
#ifdef BOOST_NO_SLIST
namespace boost {
struct slistS;
template <class ValueType> struct container_gen<slistS, ValueType> {
typedef boost::container::slist<ValueType> type;
};
template <> struct parallel_edge_traits<slistS> { typedef allow_parallel_edge_tag type; };
}
#endif
int main() {
using namespace boost;
adjacency_list<vecS, slistS> works_for_me;
}
#包括
#包括
#ifdef BOOST_NO_SLIST
名称空间提升{
结构裂缝;
模板结构容器\u gen{
typedef boost::container::slist类型;
};
模板结构parallel_edge_traits{typedef allow_parallel_edge_tag type;};
}
#恩迪夫
int main(){
使用名称空间boost;
邻接列表适用于我;
}
当然可以,我只是想把答案填好以备将来参考。原来std::forward\u list
不能用作。size()
是必需的。谢谢。尝试使用boost::add_edge
@Daniel你的观点是什么?尝试对slistS
的源代码进行灰显。您可以随时向SSCCE提出问题。container\u traits
需要使用add\u edge
和remove\u edge
@Daniel我没有尝试过(我也不会),但也许您只需要。