x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
vector_property_map.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\vector_property_map.hpp
旋转
特效
属性
历史版本
// Copyright (C) Vladimir Prus 2003. // 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) // // See http://www.boost.org/libs/graph/vector_property_map.html for // documentation. // #ifndef VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 #define VECTOR_PROPERTY_MAP_HPP_VP_2003_03_04 #include
#include
#include
namespace boost { template
class vector_property_map : public boost::put_get_helper< typename std::iterator_traits< typename std::vector
::iterator >::reference, vector_property_map
> { public: typedef typename property_traits
::key_type key_type; typedef T value_type; typedef typename std::iterator_traits< typename std::vector
::iterator >::reference reference; typedef boost::lvalue_property_map_tag category; vector_property_map(const IndexMap& index = IndexMap()) : store(new std::vector
()), index(index) {} vector_property_map(unsigned initial_size, const IndexMap& index = IndexMap()) : store(new std::vector
(initial_size)), index(index) {} typename std::vector
::iterator storage_begin() { return store->begin(); } typename std::vector
::iterator storage_end() { return store->end(); } typename std::vector
::const_iterator storage_begin() const { return store->begin(); } typename std::vector
::const_iterator storage_end() const { return store->end(); } public: // Copy ctor absent, default semantics is OK. // Assignment operator absent, default semantics is OK. // CONSIDER: not sure that assignment to 'index' is correct. reference operator[](const key_type& v) const { typename property_traits
::value_type i = get(index, v); if (static_cast
(i) >= store->size()) { store->resize(i + 1, T()); } return (*store)[i]; } private: // Conceptually, we have a vector of infinite size. For practical // purposes, we start with an empty vector and grow it as needed. // Note that we cannot store pointer to vector here -- we cannot // store pointer to data, because if copy of property map resizes // the vector, the pointer to data will be invalidated. // I wonder if class 'pmap_ref' is simply needed. shared_ptr< std::vector
> store; IndexMap index; }; template
vector_property_map
make_vector_property_map(IndexMap index) { return vector_property_map
(index); } } #endif
vector_property_map.hpp
网页地址
文件地址
上一页
109/113
下一页
下载
( 3 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.