x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
indexed_properties.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\graph\detail\indexed_properties.hpp
旋转
特效
属性
历史版本
// Copyright 2005 The Trustees of Indiana University. // 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) // Authors: Jeremiah Willcock // Douglas Gregor // Andrew Lumsdaine // Indexed properties -- used for CSR and CSR-like graphs #ifndef BOOST_GRAPH_INDEXED_PROPERTIES_HPP #define BOOST_GRAPH_INDEXED_PROPERTIES_HPP #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace detail { template
class indexed_vertex_properties { public: typedef no_property vertex_property_type; typedef Property vertex_bundled; // Directly access a vertex or edge bundle Property& operator[](Descriptor v) { return m_vertex_properties[get(vertex_index, derived(), v)]; } const Property& operator[](Descriptor v) const { return m_vertex_properties[get(vertex_index, derived(), v)]; } protected: // Default-construct with no property values indexed_vertex_properties() {} // Initialize with n default-constructed property values indexed_vertex_properties(std::size_t n) : m_vertex_properties(n) { } public: // Resize the properties vector void resize(std::size_t n) { m_vertex_properties.resize(n); } // Reserve space in the vector of properties void reserve(std::size_t n) { m_vertex_properties.reserve(n); } // Add a new property value to the back void push_back(const Property& prop) { m_vertex_properties.push_back(prop); } // Access to the derived object Derived& derived() { return *static_cast
(this); } const Derived& derived() const { return *static_cast
(this); } public: // should be private, but friend templates not portable std::vector
m_vertex_properties; }; template
class indexed_vertex_properties
{ struct secret {}; public: typedef no_property vertex_property_type; typedef void vertex_bundled; secret operator[](secret) { return secret(); } protected: // All operations do nothing. indexed_vertex_properties() { } indexed_vertex_properties(std::size_t) { } public: void resize(std::size_t) { } void reserve(std::size_t) { } }; template
class indexed_edge_properties { public: typedef no_property edge_property_type; typedef Property edge_bundled; typedef Property edge_push_back_type; // Directly access a edge or edge bundle Property& operator[](Descriptor v) { return m_edge_properties[get(edge_index, derived(), v)]; } const Property& operator[](Descriptor v) const { return m_edge_properties[get(edge_index, derived(), v)]; } protected: // Default-construct with no property values indexed_edge_properties() {} // Initialize with n default-constructed property values indexed_edge_properties(std::size_t n) : m_edge_properties(n) { } // Resize the properties vector void resize(std::size_t n) { m_edge_properties.resize(n); } // Reserve space in the vector of properties void reserve(std::size_t n) { m_edge_properties.reserve(n); } public: // Add a new property value to the back void push_back(const Property& prop) { m_edge_properties.push_back(prop); } private: // Access to the derived object Derived& derived() { return *static_cast
(this); } const Derived& derived() const { return *static_cast
(this); } public: // should be private, but friend templates not portable std::vector
m_edge_properties; }; template
class indexed_edge_properties
{ struct secret {}; public: typedef no_property edge_property_type; typedef void edge_bundled; typedef void* edge_push_back_type; secret operator[](secret) { return secret(); } protected: // All operations do nothing. indexed_edge_properties() { } indexed_edge_properties(std::size_t) { } void resize(std::size_t) { } void reserve(std::size_t) { } public: void push_back(const edge_push_back_type&) { } }; } } #endif // BOOST_GRAPH_INDEXED_PROPERTIES_HPP
indexed_properties.hpp
网页地址
文件地址
上一页
8/16
下一页
下载
( 4 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.