x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
set_view_base.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\bimap\detail\set_view_base.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 detail/set_view_base.hpp /// \brief Helper base for the construction of the bimap views types. #ifndef BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP #define BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP #if defined(_MSC_VER) && (_MSC_VER>=1200) #pragma once #endif #include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace bimaps { namespace detail { template< class Key, class Value, class KeyToBase > class set_view_key_to_base { public: const Key operator()( const Value & v ) const { return keyToBase( v ); } private: KeyToBase keyToBase; }; template< class MutantRelationStorage, class KeyToBase > class set_view_key_to_base
{ typedef BOOST_DEDUCED_TYPENAME MutantRelationStorage::non_mutable_storage non_mutable_storage; public: const MutantRelationStorage & operator()( const non_mutable_storage & k ) const { return ::boost::bimaps::relation::detail::mutate
(k); } const MutantRelationStorage & operator()( const MutantRelationStorage & k ) const { return k; } }; // The next macro can be converted in a metafunctor to gain code robustness. /*===========================================================================*/ #define BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR( \ CONTAINER_ADAPTOR, CORE_INDEX, OTHER_ITER, CONST_OTHER_ITER \ ) \ ::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \ < \ CORE_INDEX, \ ::boost::bimaps::detail:: \ set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator >, \ ::boost::bimaps::detail:: \ const_set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator >, \ ::boost::bimaps::detail:: \ set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::OTHER_ITER >, \ ::boost::bimaps::detail:: \ const_set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::CONST_OTHER_ITER >, \ ::boost::bimaps::container_adaptor::support::iterator_facade_to_base \ < \ ::boost::bimaps::detail:: set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator>, \ ::boost::bimaps::detail::const_set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator> \ \ >, \ ::boost::mpl::na, \ ::boost::mpl::na, \ ::boost::bimaps::relation::detail:: \ get_mutable_relation_functor< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >, \ ::boost::bimaps::relation::support:: \ get_above_view_functor< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >, \ ::boost::bimaps::detail::set_view_key_to_base< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::key_type, \ BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type, \ BOOST_DEDUCED_TYPENAME CORE_INDEX::key_from_value \ > \ > /*===========================================================================*/ /*===========================================================================*/ #define BOOST_BIMAP_SEQUENCED_SET_VIEW_CONTAINER_ADAPTOR( \ CONTAINER_ADAPTOR, CORE_INDEX, OTHER_ITER, CONST_OTHER_ITER \ ) \ ::boost::bimaps::container_adaptor::CONTAINER_ADAPTOR \ < \ CORE_INDEX, \ ::boost::bimaps::detail:: \ set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator >, \ ::boost::bimaps::detail:: \ const_set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator >, \ ::boost::bimaps::detail:: \ set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::OTHER_ITER >, \ ::boost::bimaps::detail:: \ const_set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::CONST_OTHER_ITER >, \ ::boost::bimaps::container_adaptor::support::iterator_facade_to_base \ < \ ::boost::bimaps::detail:: set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::iterator>, \ ::boost::bimaps::detail::const_set_view_iterator< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::const_iterator> \ \ >, \ ::boost::mpl::na, \ ::boost::mpl::na, \ ::boost::bimaps::relation::detail:: \ get_mutable_relation_functor< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type >, \ ::boost::bimaps::relation::support:: \ get_above_view_functor< \ BOOST_DEDUCED_TYPENAME CORE_INDEX::value_type > \ > /*===========================================================================*/ #if defined(BOOST_MSVC) /*===========================================================================*/ #define BOOST_BIMAP_SET_VIEW_BASE_FRIEND(TYPE,INDEX_TYPE) \ typedef ::boost::bimaps::detail::set_view_base< \ TYPE< INDEX_TYPE >, INDEX_TYPE > template_class_friend; \ friend class template_class_friend; /*===========================================================================*/ #else /*===========================================================================*/ #define BOOST_BIMAP_SET_VIEW_BASE_FRIEND(TYPE,INDEX_TYPE) \ friend class ::boost::bimaps::detail::set_view_base< \ TYPE< INDEX_TYPE >, INDEX_TYPE >; /*===========================================================================*/ #endif /// \brief Common base for set views. template< class Derived, class Index > class set_view_base { typedef ::boost::bimaps::container_adaptor::support:: iterator_facade_to_base < ::boost::bimaps::detail:: set_view_iterator
, ::boost::bimaps::detail:: const_set_view_iterator
> iterator_to_base_; typedef BOOST_DEDUCED_TYPENAME Index::value_type::left_value_type left_type_; typedef BOOST_DEDUCED_TYPENAME Index::value_type::right_value_type right_type_; typedef BOOST_DEDUCED_TYPENAME Index::value_type value_type_; typedef ::boost::bimaps::detail:: set_view_iterator
iterator_; public: bool replace(iterator_ position, const value_type_ & x) { return derived().base().replace( derived().template functor
()(position),x ); } template< class CompatibleLeftType > bool replace_left(iterator_ position, const CompatibleLeftType & l) { return derived().base().replace( derived().template functor
()(position), value_type_(l,position->right) ); } template< class CompatibleRightType > bool replace_right(iterator_ position, const CompatibleRightType & r) { return derived().base().replace( derived().template functor
()(position), value_type_(position->left,r) ); } /* This function may be provided in the future template< class Modifier > bool modify(iterator_ position, Modifier mod) { return derived().base().modify( derived().template functor
()(position), ::boost::bimaps::detail::relation_modifier_adaptor < Modifier, BOOST_DEDUCED_TYPENAME Index::value_type, BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: data_extractor < ::boost::bimaps::relation::member_at::left, BOOST_DEDUCED_TYPENAME Index::value_type >::type, BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: data_extractor < ::boost::bimaps::relation::member_at::right, BOOST_DEDUCED_TYPENAME Index::value_type >::type >(mod) ); } */ /* template< class Modifier > bool modify_left(iterator_ position, Modifier mod) { typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: data_extractor < BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::member_at::right, BOOST_DEDUCED_TYPENAME Index::value_type >::type left_data_extractor_; return derived().base().modify( derived().template functor
()(position), // this may be replaced later by // ::boost::bind( mod, ::boost::bind(data_extractor_(),_1) ) ::boost::bimaps::detail::unary_modifier_adaptor < Modifier, BOOST_DEDUCED_TYPENAME Index::value_type, left_data_extractor_ >(mod) ); } template< class Modifier > bool modify_right(iterator_ position, Modifier mod) { typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support:: data_extractor < BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::member_at::right, BOOST_DEDUCED_TYPENAME Index::value_type >::type right_data_extractor_; return derived().base().modify( derived().template functor
()(position), // this may be replaced later by // ::boost::bind( mod, ::boost::bind(data_extractor_(),_1) ) ::boost::bimaps::detail::unary_modifier_adaptor < Modifier, BOOST_DEDUCED_TYPENAME Index::value_type, right_data_extractor_ >(mod) ); } */ protected: typedef set_view_base set_view_base_; private: // Curiously Recurring Template interface. Derived& derived() { return *static_cast
(this); } Derived const& derived() const { return *static_cast
(this); } }; } // namespace detail } // namespace bimaps } // namespace boost #endif // BOOST_BIMAP_DETAIL_SET_VIEW_BASE_HPP
set_view_base.hpp
网页地址
文件地址
上一页
13/15
下一页
下载
( 13 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.