x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
results_cache.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\xpressive\detail\core\results_cache.hpp
旋转
特效
属性
历史版本
/////////////////////////////////////////////////////////////////////////////// // results_cache.hpp // // Copyright 2007 Eric Niebler. 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_XPRESSIVE_DETAIL_CORE_RESULTS_CACHE_HPP_EAN_10_04_2005 #define BOOST_XPRESSIVE_DETAIL_CORE_RESULTS_CACHE_HPP_EAN_10_04_2005 // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
#include
#include
#include
#include
namespace boost { namespace xpressive { namespace detail { /////////////////////////////////////////////////////////////////////////////// // nested_results // BUGBUG by using std::list, it makes construction of of an empty nested_results // incur a dynamic allocation. As a result, construction an empty match_results is // likewise not free. FIXME. #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206)) template
struct nested_results : std::list
> { friend struct results_cache
; friend struct match_results
; }; #else template
struct nested_results : private std::list
> { friend struct results_cache
; friend struct match_results
; typedef std::list
> base_type; using base_type::iterator; using base_type::const_iterator; #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB , == 1) // old Dinkumware doesn't expose pointer typedefs typedef base_type::value_type *pointer; typedef base_type::value_type const *const_pointer; #else using base_type::pointer; using base_type::const_pointer; #endif using base_type::reference; using base_type::const_reference; using base_type::size_type; using base_type::begin; using base_type::end; using base_type::size; using base_type::empty; using base_type::front; using base_type::back; }; #endif /////////////////////////////////////////////////////////////////////////////// // results_cache // // cache storage for reclaimed match_results structs template
struct results_cache { typedef core_access
access; match_results
&append_new(nested_results
&out) { if(this->cache_.empty()) { out.push_back(match_results
()); } else { BOOST_ASSERT(access::get_nested_results(this->cache_.back()).empty()); out.splice(out.end(), this->cache_, --this->cache_.end()); } return out.back(); } // move the last match_results struct into the cache void reclaim_last(nested_results
&out) { BOOST_ASSERT(!out.empty()); // first, reclaim any nested results nested_results
&nested = access::get_nested_results(out.back()); if(!nested.empty()) { this->reclaim_all(nested); } // then, reclaim the last match_results this->cache_.splice(this->cache_.end(), out, --out.end()); } // move the last n match_results structs into the cache void reclaim_last_n(nested_results
&out, std::size_t count) { for(; 0 != count; --count) { this->reclaim_last(out); } } void reclaim_all(nested_results
&out) { typedef typename nested_results
::iterator iter_type; // first, recursively reclaim all the nested results for(iter_type begin = out.begin(); begin != out.end(); ++begin) { nested_results
&nested = access::get_nested_results(*begin); if(!nested.empty()) { this->reclaim_all(nested); } } // next, reclaim the results themselves this->cache_.splice(this->cache_.end(), out); } private: nested_results
cache_; }; }}} // namespace boost::xpressive::detail #endif
results_cache.hpp
网页地址
文件地址
上一页
13/16
下一页
下载
( 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.