x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
static.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\spirit\core\non_terminal\impl\static.hpp
旋转
特效
属性
历史版本
/*============================================================================= Copyright (c) 2006 João Abecasis http://spirit.sourceforge.net/ Use, modification and distribution is subject to 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) =============================================================================*/ #if !defined(BOOST_SPIRIT_STATIC_HPP) #define BOOST_SPIRIT_STATIC_HPP #include
#include
#include
#include
#include
#include
#include
// for placement new namespace boost { namespace spirit { // // Provides thread-safe initialization of a single static instance of T. // // This instance is guaranteed to be constructed on static storage in a // thread-safe manner, on the first call to the constructor of static_. // // Requirements: // T is default constructible // (There's an alternate implementation that relaxes this // requirement -- João Abecasis) // T::T() MUST not throw! // this is a requirement of boost::call_once. // template
struct static_ : boost::noncopyable { typedef T value_type; typedef typename boost::call_traits
::reference reference; typedef typename boost::call_traits
::const_reference const_reference; static_(Tag = Tag()) { struct destructor { ~destructor() { static_::get_address()->~value_type(); } }; struct default_ctor { static void construct() { ::new (static_::get_address()) value_type(); static destructor d; } }; boost::call_once(&default_ctor::construct, constructed_); } operator reference() { return this->get(); } operator const_reference() const { return this->get(); } reference get() { return *this->get_address(); } const_reference get() const { return *this->get_address(); } private: typedef typename boost::add_pointer
::type pointer; static pointer get_address() { return static_cast
(data_.address()); } typedef boost::aligned_storage
::value> storage_type; static storage_type data_; static once_flag constructed_; }; template
typename static_
::storage_type static_
::data_; template
once_flag static_
::constructed_ = BOOST_ONCE_INIT; }} // namespace boost::spirit #endif // include guard
static.hpp
网页地址
文件地址
上一页
4/5
下一页
下载
( 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.