x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
edge_list.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\graph\edge_list.hpp
旋转
特效
属性
历史版本
//======================================================================= // Copyright 1997, 1998, 1999, 2000 University of Notre Dame. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= // #ifndef BOOST_GRAPH_EDGE_LIST_HPP #define BOOST_GRAPH_EDGE_LIST_HPP #include
#include
#include
#include
#include
#include
#include
namespace boost { // // The edge_list class is an EdgeListGraph module that is constructed // from a pair of iterators whose value type is a pair of vertex // descriptors. // // For example: // // typedef std::pair
E; // list
elist; // ... // typedef edge_list
::iterator> Graph; // Graph g(elist.begin(), elist.end()); // // If the iterators are random access, then Graph::edge_descriptor // is of Integral type, otherwise it is a struct, though it is // convertible to an Integral type. // struct edge_list_tag { }; // The implementation class for edge_list. template
class edge_list_impl { public: typedef D edge_id; typedef T Vpair; typedef typename Vpair::first_type V; typedef V vertex_descriptor; typedef edge_list_tag graph_tag; typedef void edge_property_type; struct edge_descriptor { edge_descriptor() { } edge_descriptor(EdgeIter p, edge_id id) : _ptr(p), _id(id) { } operator edge_id() { return _id; } EdgeIter _ptr; edge_id _id; }; typedef edge_descriptor E; struct edge_iterator { typedef edge_iterator self; typedef E value_type; typedef E& reference; typedef E* pointer; typedef std::ptrdiff_t difference_type; typedef std::input_iterator_tag iterator_category; edge_iterator() { } edge_iterator(EdgeIter iter) : _iter(iter), _i(0) { } E operator*() { return E(_iter, _i); } self& operator++() { ++_iter; ++_i; return *this; } self operator++(int) { self t = *this; ++(*this); return t; } bool operator==(const self& x) { return _iter == x._iter; } bool operator!=(const self& x) { return _iter != x._iter; } EdgeIter _iter; edge_id _i; }; typedef void out_edge_iterator; typedef void in_edge_iterator; typedef void adjacency_iterator; typedef void vertex_iterator; }; template
std::pair
::edge_iterator, typename edge_list_impl
::edge_iterator> edges(const edge_list_impl
& g_) { const G& g = static_cast
(g_); typedef typename edge_list_impl
::edge_iterator edge_iterator; return std::make_pair(edge_iterator(g._first), edge_iterator(g._last)); } template
typename edge_list_impl
::vertex_descriptor source(typename edge_list_impl
::edge_descriptor e, const edge_list_impl
&) { return (*e._ptr).first; } template
typename edge_list_impl
::vertex_descriptor target(typename edge_list_impl
::edge_descriptor e, const edge_list_impl
&) { return (*e._ptr).second; } template
class el_edge_property_map : public put_get_helper
>{ public: typedef E key_type; typedef D value_type; typedef D reference; typedef readable_property_map_tag category; value_type operator[](key_type e) const { return e._i; } }; struct edge_list_edge_property_selector { template
struct bind_ { typedef el_edge_property_map
type; typedef type const_type; }; }; template <> struct edge_property_selector
{ typedef edge_list_edge_property_selector type; }; template
typename property_map< edge_list_impl
, edge_index_t>::type get(edge_index_t, const edge_list_impl
&) { typedef typename property_map< edge_list_impl
, edge_index_t>::type EdgeIndexMap; return EdgeIndexMap(); } template
inline D get(edge_index_t, const edge_list_impl
&, typename edge_list_impl
::edge_descriptor e) { return e._i; } // A specialized implementation for when the iterators are random access. struct edge_list_ra_tag { }; template
class edge_list_impl_ra { public: typedef D edge_id; typedef T Vpair; typedef typename Vpair::first_type V; typedef edge_list_ra_tag graph_tag; typedef void edge_property_type; typedef edge_id edge_descriptor; typedef V vertex_descriptor; typedef typename boost::integer_range
::iterator edge_iterator; typedef void out_edge_iterator; typedef void in_edge_iterator; typedef void adjacency_iterator; typedef void vertex_iterator; }; template
std::pair
::edge_iterator, typename edge_list_impl_ra
::edge_iterator> edges(const edge_list_impl_ra
& g_) { const G& g = static_cast
(g_); typedef typename edge_list_impl_ra
::edge_iterator edge_iterator; return std::make_pair(edge_iterator(0), edge_iterator(g._last - g._first)); } template
typename edge_list_impl_ra
::vertex_descriptor source(typename edge_list_impl_ra
::edge_descriptor e, const edge_list_impl_ra
& g_) { const G& g = static_cast
(g_); return g._first[e].first; } template
typename edge_list_impl_ra
::vertex_descriptor target(typename edge_list_impl_ra
::edge_descriptor e, const edge_list_impl_ra
& g_) { const G& g = static_cast
(g_); return g._first[e].second; } template
class el_ra_edge_property_map : public put_get_helper
>{ public: typedef E key_type; typedef E value_type; typedef E reference; typedef readable_property_map_tag category; value_type operator[](key_type e) const { return e; } }; struct edge_list_ra_edge_property_selector { template
struct bind_ { typedef el_ra_edge_property_map
type; typedef type const_type; }; }; template <> struct edge_property_selector
{ typedef edge_list_ra_edge_property_selector type; }; template
inline typename property_map< edge_list_impl_ra
, edge_index_t>::type get(edge_index_t, const edge_list_impl_ra
&) { typedef typename property_map< edge_list_impl_ra
, edge_index_t>::type EdgeIndexMap; return EdgeIndexMap(); } template
inline D get(edge_index_t, const edge_list_impl_ra
&, typename edge_list_impl_ra
::edge_descriptor e) { return e; } // Some helper classes for determining if the iterators are random access template
struct is_random { enum { RET = false }; typedef mpl::false_ type; }; template <> struct is_random
{ enum { RET = true }; typedef mpl::true_ type; }; // The edge_list class conditionally inherits from one of the // above two classes. template
::value_type, class D = typename std::iterator_traits
::difference_type, class Cat = typename std::iterator_traits
::iterator_category> #else class T, class D, class Cat> #endif class edge_list : public mpl::if_< typename is_random
::type, edge_list_impl_ra< edge_list
, EdgeIter,T,D>, edge_list_impl< edge_list
, EdgeIter,T,D> >::type { public: typedef directed_tag directed_category; typedef allow_parallel_edge_tag edge_parallel_category; typedef edge_list_graph_tag traversal_category; typedef std::size_t edges_size_type; typedef std::size_t vertices_size_type; typedef std::size_t degree_size_type; edge_list(EdgeIter first, EdgeIter last) : _first(first), _last(last) { m_num_edges = std::distance(first, last); } edge_list(EdgeIter first, EdgeIter last, edges_size_type E) : _first(first), _last(last), m_num_edges(E) { } EdgeIter _first, _last; edges_size_type m_num_edges; }; template
std::size_t num_edges(const edge_list
& el) { return el.m_num_edges; } #ifndef BOOST_NO_STD_ITERATOR_TRAITS template
inline edge_list
make_edge_list(EdgeIter first, EdgeIter last) { return edge_list
(first, last); } #endif } /* namespace boost */ #endif /* BOOST_GRAPH_EDGE_LIST_HPP */
edge_list.hpp
网页地址
文件地址
上一页
26/95
下一页
下载
( 9 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.