x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
list_base.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\graph\detail\list_base.hpp
旋转
特效
属性
历史版本
//======================================================================= // Copyright 2002 Indiana University. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek // // 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_LIST_BASE_HPP #define BOOST_LIST_BASE_HPP #include
// Perhaps this should go through formal review, and move to
. /* An alternate interface idea: Extend the std::list functionality by creating remove/insert functions that do not require the container object! */ namespace boost { namespace detail { //========================================================================= // Linked-List Generic Implementation Functions template
inline Node slist_insert_after(Node pos, Node x, Next next) { next(x) = next(pos); next(pos) = x; return x; } // return next(pos) or next(next(pos)) ? template
inline Node slist_remove_after(Node pos, Next next) { Node n = next(pos); next(pos) = next(n); return n; } template
inline Node slist_remove_range(Node before_first, Node last, Next next) { next(before_first) = last; return last; } template
inline Node slist_previous(Node head, Node x, Node nil, Next next) { while (head != nil && next(head) != x) head = next(head); return head; } template
inline void slist_splice_after(Node pos, Node before_first, Node before_last, Next next) { if (pos != before_first && pos != before_last) { Node first = next(before_first); Node after = next(pos); next(before_first) = next(before_last); next(pos) = first; next(before_last) = after; } } template
inline Node slist_reverse(Node node, Node nil, Next next) { Node result = node; node = next(node); next(result) = nil; while(node) { Node next = next(node); next(node) = result; result = node; node = next; } return result; } template
inline std::size_t slist_size(Node head, Node nil, Next next) { std::size_t s = 0; for ( ; head != nil; head = next(head)) ++s; return s; } template
class slist_iterator_policies { public: explicit slist_iterator_policies(const Next& n, const Data& d) : m_next(n), m_data(d) { } template
Reference dereference(type
, const Node& x) const { return m_data(x); } template
void increment(Node& x) const { x = m_next(x); } template
bool equal(Node& x, Node& y) const { return x == y; } protected: Next m_next; Data m_data; }; //=========================================================================== // Doubly-Linked List Generic Implementation Functions template
inline void dlist_insert_before(Node pos, Node x, Next next, Prev prev) { next(x) = pos; prev(x) = prev(pos); next(prev(pos)) = x; prev(pos) = x; } template
void dlist_remove(Node pos, Next next, Prev prev) { Node next_node = next(pos); Node prev_node = prev(pos); next(prev_node) = next_node; prev(next_node) = prev_node; } // This deletes every node in the list except the // sentinel node. template
inline void dlist_clear(Node sentinel, Delete del) { Node i, tmp; i = next(sentinel); while (i != sentinel) { tmp = i; i = next(i); del(tmp); } } template
inline bool dlist_empty(Node dummy) { return next(dummy) == dummy; } template
void dlist_transfer(Node pos, Node first, Node last, Next next, Prev prev) { if (pos != last) { // Remove [first,last) from its old position next(prev(last)) = pos; next(prev(first)) = last; next(prev(pos)) = first; // Splice [first,last) into its new position Node tmp = prev(pos); prev(pos) = prev(last); prev(last) = prev(first); prev(first) = tmp; } } template
class dlist_iterator_policies : public slist_iterator_policies
{ typedef slist_iterator_policies
Base; public: template
void decrement(Node& x) const { x = m_prev(x); } dlist_iterator_policies(Next n, Prev p, Data d) : Base(n,d), m_prev(p) { } protected: Prev m_prev; }; } // namespace detail } // namespace boost #endif // BOOST_LIST_BASE_HPP
list_base.hpp
网页地址
文件地址
上一页
10/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.