x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
iterator.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\python\iterator.hpp
旋转
特效
属性
历史版本
// Copyright David Abrahams 2002. // 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 ITERATOR_DWA2002512_HPP # define ITERATOR_DWA2002512_HPP # include
# include
# include
# include
# include
# include
# include
# include
namespace boost { namespace python { namespace detail { // Adds an additional layer of binding to // objects::make_iterator(...), which allows us to pass member // function and member data pointers. template
inline object make_iterator( Accessor1 get_start , Accessor2 get_finish , NextPolicies next_policies , Target&(*)() ) { return objects::make_iterator_function
( boost::protect(boost::bind(get_start, _1)) , boost::protect(boost::bind(get_finish, _1)) , next_policies ); } // Guts of template class iterators<>, below. template
struct iterators_impl { template
struct apply { typedef typename T::iterator iterator; static iterator begin(T& x) { return x.begin(); } static iterator end(T& x) { return x.end(); } }; }; template <> struct iterators_impl
{ template
struct apply { typedef typename T::const_iterator iterator; static iterator begin(T& x) { return x.begin(); } static iterator end(T& x) { return x.end(); } }; }; } // An "ordinary function generator" which contains static begin(x) and // end(x) functions that invoke T::begin() and T::end(), respectively. template
struct iterators : detail::iterators_impl< boost::is_const
::value >::template apply
{ }; // Create an iterator-building function which uses the given // accessors. Deduce the Target type from the accessors. The iterator // returns copies of the inderlying elements. template
object range(Accessor1 start, Accessor2 finish) { return detail::make_iterator( start, finish , objects::default_iterator_call_policies() , detail::target(start) ); } // Create an iterator-building function which uses the given accessors // and next() policies. Deduce the Target type. template
object range(Accessor1 start, Accessor2 finish, NextPolicies* = 0) { return detail::make_iterator(start, finish, NextPolicies(), detail::target(start)); } // Create an iterator-building function which uses the given accessors // and next() policies, operating on the given Target type template
object range(Accessor1 start, Accessor2 finish, NextPolicies* = 0, boost::type
* = 0) { // typedef typename add_reference
::type target; return detail::make_iterator(start, finish, NextPolicies(), (Target&(*)())0); } // A Python callable object which produces an iterator traversing // [x.begin(), x.end()), where x is an instance of the Container // type. NextPolicies are used as the CallPolicies for the iterator's // next() function. template
struct iterator : object { iterator() : object( python::range
( &iterators
::begin, &iterators
::end )) { } }; }} // namespace boost::python #endif // ITERATOR_DWA2002512_HPP
iterator.hpp
网页地址
文件地址
上一页
33/85
下一页
下载
( 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.