x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
shadow_iterator.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\graph\detail\shadow_iterator.hpp
旋转
特效
属性
历史版本
// (C) Copyright Jeremy Siek 2001. // 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 BOOST_SHADOW_ITERATOR_HPP #define BOOST_SHADOW_ITERATOR_HPP #include
#include
namespace boost { namespace detail { template
class shadow_proxy : boost::operators< shadow_proxy
> { typedef shadow_proxy self; public: inline shadow_proxy(A aa, B bb) : a(aa), b(bb) { } inline shadow_proxy(const self& x) : a(x.a), b(x.b) { } template
inline shadow_proxy(Self x) : a(x.a), b(x.b) { } inline self& operator=(const self& x) { a = x.a; b = x.b; return *this; } inline self& operator++() { ++a; return *this; } inline self& operator--() { --a; return *this; } inline self& operator+=(const self& x) { a += x.a; return *this; } inline self& operator-=(const self& x) { a -= x.a; return *this; } inline self& operator*=(const self& x) { a *= x.a; return *this; } inline self& operator/=(const self& x) { a /= x.a; return *this; } inline self& operator%=(const self& x) { return *this; } // JGS inline self& operator&=(const self& x) { return *this; } // JGS inline self& operator|=(const self& x) { return *this; } // JGS inline self& operator^=(const self& x) { return *this; } // JGS inline friend D operator-(const self& x, const self& y) { return x.a - y.a; } inline bool operator==(const self& x) const { return a == x.a; } inline bool operator<(const self& x) const { return a < x.a; } // protected: A a; B b; }; struct shadow_iterator_policies { template
void initialize(const iter_pair&) { } template
typename Iter::reference dereference(const Iter& i) const { typedef typename Iter::reference R; return R(*i.base().first, *i.base().second); } template
bool equal(const Iter& p1, const Iter& p2) const { return p1.base().first == p2.base().first; } template
void increment(Iter& i) { ++i.base().first; ++i.base().second; } template
void decrement(Iter& i) { --i.base().first; --i.base().second; } template
bool less(const Iter& x, const Iter& y) const { return x.base().first < y.base().first; } template
typename Iter::difference_type distance(const Iter& x, const Iter& y) const { return y.base().first - x.base().first; } template
void advance(Iter& p, D n) { p.base().first += n; p.base().second += n; } }; } // namespace detail template
struct shadow_iterator_generator { // To use the iterator_adaptor we can't derive from // random_access_iterator because we don't have a real reference. // However, we want the STL algorithms to treat the shadow // iterator like a random access iterator. struct shadow_iterator_tag : public std::input_iterator_tag { operator std::random_access_iterator_tag() { return std::random_access_iterator_tag(); }; }; typedef typename std::iterator_traits
::value_type Aval; typedef typename std::iterator_traits
::value_type Bval; typedef typename std::iterator_traits
::reference Aref; typedef typename std::iterator_traits
::reference Bref; typedef typename std::iterator_traits
::difference_type D; typedef detail::shadow_proxy
V; typedef detail::shadow_proxy
R; typedef iterator_adaptor< std::pair
, detail::shadow_iterator_policies, V, R, V*, shadow_iterator_tag, D> type; }; // short cut for creating a shadow iterator template
inline typename shadow_iterator_generator
::type make_shadow_iter(IterA a, IterB b) { typedef typename shadow_iterator_generator
::type Iter; return Iter(std::make_pair(a,b)); } template
struct shadow_cmp { inline shadow_cmp(const Cmp& c) : cmp(c) { } template
inline bool operator()(const ShadowProxy1& x, const ShadowProxy2& y) const { return cmp(x.a, y.a); } Cmp cmp; }; } // namespace boost namespace std { template
void swap(boost::detail::shadow_proxy
x, boost::detail::shadow_proxy
y) { std::swap(x.a, y.a); std::swap(x.b, y.b); } } #endif // BOOST_SHADOW_ITERATOR_HPP
shadow_iterator.hpp
网页地址
文件地址
上一页
15/16
下一页
下载
( 5 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.