BGL 中的 slistS 发生了什么?
What's happened to slistS in BGL?
我正在使用 Boost 1.60 adjacency_list
并且想使用 slistS
作为模板参数 OutEdgeList
:
using Graph = boost::adjacency_list<
boost::slistS, boost::listS, boost::bidirectionalS
>;
这不编译。查看 adjacency_list.hpp 似乎在没有旧 STL std::slist
:
的情况下明确删除了此类型
#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_list
吗?如果没有,是否有任何计划将其包含在 BGL 的未来版本中?
在我看来,这似乎是 Clang/Libc++ 所特有的,其中缺少 <slist>
。它不是 c++ 标准的一部分。
用 GCC/libstdc++ 编译没问题(用 GCC 5.2 和 c++14 测试过)。
所以我只使用 boost::container::slist
:
#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;
}
我正在使用 Boost 1.60 adjacency_list
并且想使用 slistS
作为模板参数 OutEdgeList
:
using Graph = boost::adjacency_list<
boost::slistS, boost::listS, boost::bidirectionalS
>;
这不编译。查看 adjacency_list.hpp 似乎在没有旧 STL std::slist
:
#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_list
吗?如果没有,是否有任何计划将其包含在 BGL 的未来版本中?
在我看来,这似乎是 Clang/Libc++ 所特有的,其中缺少 <slist>
。它不是 c++ 标准的一部分。
用 GCC/libstdc++ 编译没问题(用 GCC 5.2 和 c++14 测试过)。
所以我只使用 boost::container::slist
:
#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;
}