x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
visitor_ptr.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\variant\visitor_ptr.hpp
旋转
特效
属性
历史版本
//----------------------------------------------------------------------------- // boost variant/visitor_ptr.hpp header file // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 // Eric Friedman // // 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_VARIANT_VISITOR_PTR_HPP #define BOOST_VARIANT_VISITOR_PTR_HPP #include "boost/variant/bad_visit.hpp" #include "boost/variant/static_visitor.hpp" #include "boost/mpl/eval_if.hpp" #include "boost/mpl/identity.hpp" #include "boost/type_traits/add_reference.hpp" #include "boost/type_traits/is_reference.hpp" #include "boost/type_traits/is_void.hpp" namespace boost { ////////////////////////////////////////////////////////////////////////// // function template visitor_ptr // // Adapts a function pointer for use as visitor capable of handling // values of a single type. Throws bad_visit if inappropriately applied. // template
class visitor_ptr_t : public static_visitor
{ private: // representation typedef R (*visitor_t)(T); visitor_t visitor_; public: // typedefs typedef R result_type; private: // private typedefs typedef typename mpl::eval_if< is_reference
, mpl::identity
, add_reference
>::type argument_fwd_type; public: // structors explicit visitor_ptr_t(visitor_t visitor) : visitor_(visitor) { } public: // static visitor interfaces template
result_type operator()(const U&) const { throw bad_visit(); } #if !defined(BOOST_NO_VOID_RETURNS) public: // static visitor interfaces, cont. result_type operator()(argument_fwd_type operand) const { return visitor_(operand); } #else // defined(BOOST_NO_VOID_RETURNS) private: // helpers, for static visitor interfaces (below) result_type execute_impl(argument_fwd_type operand, mpl::false_) const { return visitor_(operand); } BOOST_VARIANT_AUX_RETURN_VOID_TYPE execute_impl(argument_fwd_type operand, mpl::true_) const { visitor_(operand); BOOST_VARIANT_AUX_RETURN_VOID; } public: // static visitor interfaces, cont. BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) operator()(argument_fwd_type operand) const { typedef typename is_void
::type has_void_result; return execute_impl(operand, has_void_result()); } #endif // BOOST_NO_VOID_RETURNS workaround }; template
inline visitor_ptr_t
visitor_ptr(R (*visitor)(T)) { return visitor_ptr_t
(visitor); } } // namespace boost #endif// BOOST_VISITOR_VISITOR_PTR_HPP
visitor_ptr.hpp
网页地址
文件地址
上一页
10/10 下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.