x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
forced_return.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\variant\detail\forced_return.hpp
旋转
特效
属性
历史版本
//----------------------------------------------------------------------------- // boost variant/detail/forced_return.hpp header file // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // // Copyright (c) 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_DETAIL_FORCED_RETURN_HPP #define BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP #include "boost/config.hpp" #include "boost/variant/detail/generic_result_type.hpp" #include "boost/assert.hpp" #if !defined(BOOST_MSVC) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) # include "boost/type_traits/remove_reference.hpp" #endif namespace boost { namespace detail { namespace variant { /////////////////////////////////////////////////////////////////////////////// // (detail) function template forced_return // // Logical error to permit invocation at runtime, but (artificially) satisfies // compile-time requirement of returning a result value. // #if !defined(BOOST_MSVC) \ && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_NO_VOID_RETURNS) // "standard" implementation: template
inline T forced_return( BOOST_EXPLICIT_TEMPLATE_TYPE(T) ) { // logical error: should never be here! (see above) BOOST_ASSERT(false); typedef typename boost::remove_reference
::type basic_type; basic_type* dummy = 0; return *static_cast< basic_type* >(dummy); } template <> inline void forced_return
( BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(void) ) { // logical error: should never be here! (see above) BOOST_ASSERT(false); } #elif !defined(BOOST_MSVC) // workaround implementation // // TODO: Determine the most efficient way to handle this -- as below? by // throwing? by recursive call to forced_return itself? etc. // template
inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) forced_return( BOOST_EXPLICIT_TEMPLATE_TYPE(T) ) { // logical error: should never be here! (see above) BOOST_ASSERT(false); BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) (*dummy)() = 0; return dummy(); } #else // defined(BOOST_MSVC) // msvc-specific implementation // // Leverages __declspec(noreturn) for optimized implementation. // __declspec(noreturn) inline void forced_return_no_return() {}; template
inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) forced_return( BOOST_EXPLICIT_TEMPLATE_TYPE(T) ) { // logical error: should never be here! (see above) BOOST_ASSERT(false); forced_return_no_return(); } #endif // BOOST_MSVC optimization }} // namespace detail::variant } // namespace boost #endif // BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP
forced_return.hpp
网页地址
文件地址
上一页
11/22
下一页
下载
( 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.