x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
slist_node.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\intrusive\detail\slist_node.hpp
旋转
特效
属性
历史版本
///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Ion Gaztanaga 2006-2007 // // 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/intrusive for documentation. // ///////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTRUSIVE_SLIST_NODE_HPP #define BOOST_INTRUSIVE_SLIST_NODE_HPP #include
#include
#include
#include
#include
namespace boost { namespace intrusive { template
struct slist_node { typedef typename boost::pointer_to_other
::type node_ptr; node_ptr next_; }; // slist_node_traits can be used with circular_slist_algorithms and supplies // a slist_node holding the pointers needed for a singly-linked list // it is used by slist_base_hook and slist_member_hook template
struct slist_node_traits { typedef slist_node
node; typedef typename boost::pointer_to_other
::type node_ptr; typedef typename boost::pointer_to_other
::type const_node_ptr; static node_ptr get_next(const_node_ptr n) { return n->next_; } static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } }; // slist_iterator provides some basic functions for a // node oriented bidirectional iterator: template
class slist_iterator : public std::iterator < std::forward_iterator_tag , typename detail::add_const_if_c
::type > { protected: typedef typename Container::real_value_traits real_value_traits; typedef typename real_value_traits::node_traits node_traits; typedef typename node_traits::node node; typedef typename node_traits::node_ptr node_ptr; typedef typename boost::pointer_to_other
::type void_pointer; static const bool store_container_ptr = detail::store_cont_ptr_on_it
::value; public: typedef typename detail::add_const_if_c
::type value_type; typedef value_type & reference; typedef value_type * pointer; slist_iterator() : members_ (0, 0) {} explicit slist_iterator(node_ptr node, const Container *cont_ptr) : members_ (node, cont_ptr) {} slist_iterator(slist_iterator
const& other) : members_(other.pointed_node(), other.get_container()) {} const node_ptr &pointed_node() const { return members_.nodeptr_; } slist_iterator &operator=(const node_ptr &node) { members_.nodeptr_ = node; return static_cast
(*this); } public: slist_iterator& operator++() { members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); return static_cast
(*this); } slist_iterator operator++(int) { slist_iterator result (*this); members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); return result; } bool operator== (const slist_iterator& i) const { return members_.nodeptr_ == i.pointed_node(); } bool operator!= (const slist_iterator& i) const { return !operator== (i); } value_type& operator*() const { return *operator->(); } pointer operator->() const { return detail::get_pointer(this->get_real_value_traits()->to_value_ptr(members_.nodeptr_)); } const Container *get_container() const { if(store_container_ptr) return static_cast
(members_.get_ptr()); else return 0; } const real_value_traits *get_real_value_traits() const { if(store_container_ptr) return &this->get_container()->get_real_value_traits(); else return 0; } private: struct members : public detail::select_constptr
::type { typedef typename detail::select_constptr
::type Base; members(const node_ptr &n_ptr, const void *cont) : Base(cont), nodeptr_(n_ptr) {} node_ptr nodeptr_; } members_; }; } //namespace intrusive } //namespace boost #include
#endif //BOOST_INTRUSIVE_SLIST_NODE_HPP
slist_node.hpp
网页地址
文件地址
上一页
14/18
下一页
下载
( 4 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.