DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// return_type_traits.hpp -- Boost Lambda Library --------------------------- // Copyright (C) 1999, 2000 Jaakko J�rvi (jaakko.jarvi@cs.utu.fi) // // 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) // // For more information, see www.boost.org #ifndef BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP #define BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP #include "boost/mpl/has_xxx.hpp" #include
// needed for the ptrdiff_t namespace boost { namespace lambda { using ::boost::type_traits::ice_and; using ::boost::type_traits::ice_or; using ::boost::type_traits::ice_not; // Much of the type deduction code for standard arithmetic types // from Gary Powell // different arities: template
struct return_type_1; // 1-ary actions template
struct return_type_2; // 2-ary template
struct return_type_N; // >3- ary template
struct return_type_1_prot; template
struct return_type_2_prot; // 2-ary template
struct return_type_N_prot; // >3-ary namespace detail { template
class return_type_deduction_failure {}; // In some cases return type deduction should fail (an invalid lambda // expression). Sometimes the lambda expression can be ok, the return type // just is not deducible (user defined operators). Then return type deduction // should never be entered at all, and the use of ret<> does this. // However, for nullary lambda functors, return type deduction is always // entered, and there seems to be no way around this. // (the return type is part of the prototype of the non-template // operator()(). The prototype is instantiated, even though the body // is not.) // So, in the case the return type deduction should fail, it should not // fail directly, but rather result in a valid but wrong return type, // causing a compile time error only if the function is really called. } // end detail // return_type_X_prot classes -------------------------------------------- // These classes are the first layer that gets instantiated from the // lambda_functor_base sig templates. It will check whether // the action is protectable and one of arguments is "protected" or its // evaluation will otherwise result in another lambda functor. // If this is a case, the result type will be another lambda functor. // The arguments are always non-reference types, except for comma action // where the right argument can be a reference too. This is because it // matters (in the builtin case) whether the argument is an lvalue or // rvalue: int i; i, 1 -> rvalue; 1, i -> lvalue template
struct return_type_1_prot { public: typedef typename detail::IF< // is_protectable
::value && is_lambda_functor
::value, ice_and
::value, is_lambda_functor
::value>::value, lambda_functor< lambda_functor_base< Act, tuple
::type> > >, typename return_type_1
::type >::RET type; }; // take care of the unavoidable instantiation for nullary case template
struct return_type_1_prot
{ typedef null_type type; }; // Unary actions (result from unary operators) // do not have a default return type. template
struct return_type_1 { typedef typename detail::return_type_deduction_failure
type; }; namespace detail { template
class protect_conversion { typedef typename boost::remove_reference
::type non_ref_T; public: // add const to rvalues, so that all rvalues are stored as const in // the args tuple typedef typename detail::IF_type< // boost::is_reference
::value && !boost::is_const
::value, ice_and
::value, ice_not
::value>::value>::value, detail::identity_mapping
, const_copy_argument
// handles funtion and array >::type type; // types correctly }; } // end detail template
struct return_type_2_prot { // experimental feature // We may have a lambda functor as a result type of a subexpression // (if protect) has been used. // Thus, if one of the parameter types is a lambda functor, the result // is a lambda functor as well. // We need to make a conservative choise here. // The resulting lambda functor stores all const reference arguments as // const copies. References to non-const are stored as such. // So if the source of the argument is a const open argument, a bound // argument stored as a const reference, or a function returning a // const reference, that information is lost. There is no way of // telling apart 'real const references' from just 'LL internal // const references' (or it would be really hard) // The return type is a subclass of lambda_functor, which has a converting // copy constructor. It can copy any lambda functor, that has the same // action type and code, and a copy compatible argument tuple. typedef typename boost::remove_reference
::type non_ref_A; typedef typename boost::remove_reference
::type non_ref_B; typedef typename detail::IF< // is_protectable
::value && // (is_lambda_functor
::value || is_lambda_functor
::value), ice_and
::value, ice_or
::value, is_lambda_functor
::value>::value>::value, lambda_functor< lambda_functor_base< Act, tuple
::type, typename detail::protect_conversion
::type> > >, typename return_type_2
::type >::RET type; }; // take care of the unavoidable instantiation for nullary case template
struct return_type_2_prot
{ typedef null_type type; }; // take care of the unavoidable instantiation for nullary case template
struct return_type_2_prot
{ typedef null_type type; }; // take care of the unavoidable instantiation for nullary case template
struct return_type_2_prot
{ typedef null_type type; }; // comma is a special case, as the user defined operator can return // an lvalue (reference) too, hence it must be handled at this level. template
struct return_type_2_comma { typedef typename boost::remove_reference
::type non_ref_A; typedef typename boost::remove_reference
::type non_ref_B; typedef typename detail::IF< // is_protectable
>::value && // it is protectable // (is_lambda_functor
::value || is_lambda_functor
::value), ice_and
>::value, // it is protectable ice_or
::value, is_lambda_functor
::value>::value>::value, lambda_functor< lambda_functor_base< other_action
, tuple
::type, typename detail::protect_conversion
::type> > >, typename return_type_2
, non_ref_A, non_ref_B>::type >::RET type1; // if no user defined return_type_2 (or plain_return_type_2) specialization // matches, then return the righthand argument typedef typename detail::IF< boost::is_same
::value, B, type1 >::RET type; }; // currently there are no protectable actions with > 2 args // Note, that if there will be, lambda_functor_base will have to be // changed to not get rid of references in Args elements template
struct return_type_N_prot { typedef typename return_type_N
::type type; }; // take care of the unavoidable instantiation for nullary case template
struct return_type_N_prot
{ typedef null_type type; }; // handle different kind of actions ------------------------ // use the return type given in the bind invocation as bind
(...) template
struct return_type_N
, Args> { typedef Ret type; }; // ::result_type support namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) template
struct get_result_type { typedef typename F::result_type type; }; template
struct get_sig { typedef typename function_adaptor
::template sig
::type type; }; } // namespace detail // Ret is detail::unspecified, so try to deduce return type template
struct return_type_N
, Args > { // in the case of function action, the first element in Args is // some type of function typedef typename Args::head_type Func; typedef typename detail::remove_reference_and_cv
::type plain_Func; public: // pass the function to function_adaptor, and get the return type from // that typedef typename detail::IF< detail::has_result_type
::value, detail::get_result_type
, detail::get_sig
>::RET::type type; }; } // namespace lambda } // namespace boost #endif
return_type_traits.hpp
Page URL
File URL
Prev
19/20
Next
Download
( 9 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.