x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
container_adaptor.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\bimap\container_adaptor\container_adaptor.hpp
旋转
特效
属性
历史版本
// Boost.Bimap // // Copyright (c) 2006-2007 Matias Capeletto // // 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) /// \file container_adaptor/container_adaptor.hpp /// \brief Container adaptor to build a type that is compliant to the concept of a container. #ifndef BOOST_BIMAP_CONTAINER_ADAPTOR_CONTAINER_ADAPTOR_HPP #define BOOST_BIMAP_CONTAINER_ADAPTOR_CONTAINER_ADAPTOR_HPP #if defined(_MSC_VER) && (_MSC_VER>=1200) #pragma once #endif #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace bimaps { /// \brief Container Adaptor toolbox, easy way to build new containers from existing ones. namespace container_adaptor { /// \brief Container adaptor to build a type that is compliant to the concept of a container. template < class Base, class Iterator, class ConstIterator, class IteratorToBaseConverter = ::boost::mpl::na, class IteratorFromBaseConverter = ::boost::mpl::na, class ValueToBaseConverter = ::boost::mpl::na, class ValueFromBaseConverter = ::boost::mpl::na, class FunctorsFromDerivedClasses = mpl::vector<> > class container_adaptor { // MetaData ------------------------------------------------------------- public: typedef Iterator iterator; typedef ConstIterator const_iterator; typedef BOOST_DEDUCED_TYPENAME iterator_value < iterator >::type value_type; typedef BOOST_DEDUCED_TYPENAME iterator_pointer < iterator >::type pointer; typedef BOOST_DEDUCED_TYPENAME iterator_reference< iterator >::type reference; typedef BOOST_DEDUCED_TYPENAME iterator_reference< const_iterator >::type const_reference; typedef BOOST_DEDUCED_TYPENAME Base::size_type size_type; typedef BOOST_DEDUCED_TYPENAME Base::difference_type difference_type; typedef BOOST_DEDUCED_TYPENAME mpl::if_< ::boost::mpl::is_na
, // { ::boost::bimaps::container_adaptor::detail:: iterator_to_base_identity < BOOST_DEDUCED_TYPENAME Base::iterator , iterator, BOOST_DEDUCED_TYPENAME Base::const_iterator , const_iterator >, // } // else // { IteratorToBaseConverter // } >::type iterator_to_base; typedef BOOST_DEDUCED_TYPENAME mpl::if_< ::boost::mpl::is_na
, // { ::boost::bimaps::container_adaptor::detail:: iterator_from_base_identity < BOOST_DEDUCED_TYPENAME Base::iterator , iterator, BOOST_DEDUCED_TYPENAME Base::const_iterator , const_iterator >, // } // else // { IteratorFromBaseConverter // } >::type iterator_from_base; typedef BOOST_DEDUCED_TYPENAME mpl::if_< ::boost::mpl::is_na
, // { ::boost::bimaps::container_adaptor::detail:: value_to_base_identity < BOOST_DEDUCED_TYPENAME Base::value_type, value_type >, // } // else // { ValueToBaseConverter // } >::type value_to_base; typedef BOOST_DEDUCED_TYPENAME mpl::if_< ::boost::mpl::is_na
, // { ::boost::bimaps::container_adaptor::detail:: value_from_base_identity < BOOST_DEDUCED_TYPENAME Base::value_type, value_type >, // } // else // { ValueFromBaseConverter // } >::type value_from_base; // ACCESS ----------------------------------------------------------------- public: explicit container_adaptor(Base & c) : dwfb(c) {} protected: typedef Base base_type; typedef container_adaptor container_adaptor_; const Base & base() const { return dwfb.data; } Base & base() { return dwfb.data; } // Interface -------------------------------------------------------------- public: size_type size() const { return base().size(); } size_type max_size() const { return base().max_size(); } bool empty() const { return base().empty(); } iterator begin() { return this->template functor
()( base().begin() ); } iterator end() { return this->template functor
()( base().end() ); } const_iterator begin() const { return this->template functor
()( base().begin() ); } const_iterator end() const { return this->template functor
()( base().end() ); } iterator erase(iterator pos) { return this->template functor
()( base().erase(this->template functor
()(pos)) ); } iterator erase(iterator first, iterator last) { return this->template functor
()( base().erase( this->template functor
()(first), this->template functor
()(last) ) ); } void clear() { base().clear(); } template< class InputIterator > void insert(InputIterator iterBegin, InputIterator iterEnd) { for( ; iterBegin != iterEnd ; ++iterBegin ) { base().insert( this->template functor
()( *iterBegin ) ); } } std::pair
insert( BOOST_DEDUCED_TYPENAME ::boost::call_traits< value_type >::param_type x) { std::pair< BOOST_DEDUCED_TYPENAME Base::iterator, bool > r( base().insert( this->template functor
()(x) ) ); return std::pair
( this->template functor
()(r.first),r.second ); } iterator insert(iterator pos, BOOST_DEDUCED_TYPENAME ::boost::call_traits< value_type >::param_type x) { return this->template functor
()( base().insert( this->template functor
()(pos), this->template functor
()(x)) ); } void swap( container_adaptor & c ) { base().swap( c.base() ); } // Access to functors ---------------------------------------------------- protected: template< class Functor > Functor & functor() { return dwfb.template functor
(); } template< class Functor > Functor const & functor() const { return dwfb.template functor
(); } // Data ------------------------------------------------------------------ private: ::boost::bimaps::container_adaptor::detail::data_with_functor_bag < Base &, BOOST_DEDUCED_TYPENAME mpl::copy < mpl::vector < iterator_to_base, iterator_from_base, value_to_base, value_from_base >, mpl::front_inserter< FunctorsFromDerivedClasses > >::type > dwfb; }; } // namespace container_adaptor } // namespace bimaps } // namespace boost #endif // BOOST_BIMAP_CONTAINER_ADAPTOR_CONTAINER_ADAPTOR_HPP
container_adaptor.hpp
网页地址
文件地址
上一页
2/17
下一页
下载
( 8 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.