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
// operator_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_OPERATOR_RETURN_TYPE_TRAITS_HPP #define BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP #include "boost/lambda/detail/is_instance_of.hpp" #include "boost/type_traits/same_traits.hpp" #include "boost/indirect_reference.hpp" #include
// needed for the ptrdiff_t #include
// for istream and ostream #include
// needed for operator& namespace boost { namespace lambda { namespace detail { // -- general helper templates for type deduction ------------------ // Much of the type deduction code for standard arithmetic types from Gary Powell template
struct promote_code { static const int value = -1; }; // this means that a code is not defined for A // -- the next 5 types are needed in if_then_else_return // the promotion order is not important, but they must have distinct values. template <> struct promote_code
{ static const int value = 10; }; template <> struct promote_code
{ static const int value = 20; }; template <> struct promote_code
{ static const int value = 30; }; template <> struct promote_code
{ static const int value = 40; }; template <> struct promote_code
{ static const int value = 50; }; // ---------- template <> struct promote_code
{ static const int value = 100; }; template <> struct promote_code
{ static const int value = 200; }; template <> struct promote_code
{ static const int value = 300; }; template <> struct promote_code
{ static const int value = 400; }; template <> struct promote_code
{ static const int value = 500; }; template <> struct promote_code
{ static const int value = 600; }; template <> struct promote_code
{ static const int value = 700; }; // TODO: wchar_t // forward delcaration of complex. } // namespace detail } // namespace lambda } // namespace boost namespace std { template
class complex; } namespace boost { namespace lambda { namespace detail { template <> struct promote_code< std::complex
> { static const int value = 800; }; template <> struct promote_code< std::complex
> { static const int value = 900; }; template <> struct promote_code< std::complex
> { static const int value = 1000; }; // -- int promotion ------------------------------------------- template
struct promote_to_int { typedef T type; }; template <> struct promote_to_int
{ typedef int type; }; template <> struct promote_to_int
{ typedef int type; }; template <> struct promote_to_int
{ typedef int type; }; template <> struct promote_to_int
{ typedef int type; }; template <> struct promote_to_int
{ typedef int type; }; // The unsigned short int promotion rule is this: // unsigned short int to signed int if a signed int can hold all values // of unsigned short int, otherwise go to unsigned int. template <> struct promote_to_int
{ typedef detail::IF
" messes up the parsing. unsigned int, int>::RET type; }; // TODO: think, should there be default behaviour for non-standard types? } // namespace detail // ------------------------------------------ // Unary actions ---------------------------- // ------------------------------------------ template
struct plain_return_type_1 { typedef detail::unspecified type; }; template
struct plain_return_type_1
, A> { typedef A type; }; template
struct return_type_1
, A> { typedef typename plain_return_type_1< unary_arithmetic_action
, typename detail::remove_reference_and_cv
::type >::type type; }; template
struct plain_return_type_1
, A> { typedef A type; }; // bitwise not, operator~() template
struct return_type_1
, A> { typedef typename plain_return_type_1< bitwise_action
, typename detail::remove_reference_and_cv
::type >::type type; }; // prefix increment and decrement operators return // their argument by default as a non-const reference template
struct plain_return_type_1
, A> { typedef A& type; }; template
struct return_type_1
, A> { typedef typename plain_return_type_1< pre_increment_decrement_action
, typename detail::remove_reference_and_cv
::type >::type type; }; // post decrement just returns the same plain type. template
struct plain_return_type_1
, A> { typedef A type; }; template
struct return_type_1
, A> { typedef typename plain_return_type_1< post_increment_decrement_action
, typename detail::remove_reference_and_cv
::type >::type type; }; // logical not, operator!() template
struct plain_return_type_1
, A> { typedef bool type; }; template
struct return_type_1
, A> { typedef typename plain_return_type_1< logical_action
, typename detail::remove_reference_and_cv
::type >::type type; }; // address of action --------------------------------------- template
struct return_type_1
, A> { typedef typename plain_return_type_1< other_action
, typename detail::remove_reference_and_cv
::type >::type type1; // If no user defined specialization for A, then return the // cv qualified pointer to A typedef typename detail::IF< boost::is_same
::value, typename boost::remove_reference
::type*, type1 >::RET type; }; // contentsof action ------------------------------------ // TODO: this deduction may lead to fail directly, // (if A has no specialization for iterator_traits and has no // typedef A::reference. // There is no easy way around this, cause there doesn't seem to be a way // to test whether a class is an iterator or not. // The default works with std::iterators. namespace detail { // A is a nonreference type template
struct contentsof_type { typedef typename boost::indirect_reference
::type type; }; // this is since the nullary () in lambda_functor is always instantiated template <> struct contentsof_type
{ typedef detail::unspecified type; }; template
struct contentsof_type
{ typedef typename contentsof_type
::type type1; // return a reference to the underlying const type // the IF is because the A::reference in the primary template could // be some class type rather than a real reference, hence // we do not want to make it a reference here either typedef typename detail::IF< is_reference
::value, const typename boost::remove_reference
::type &, const type1 >::RET type; }; template
struct contentsof_type
{ typedef typename contentsof_type
::type type1; typedef typename detail::IF< is_reference
::value, volatile typename boost::remove_reference
::type &, volatile type1 >::RET type; }; template
struct contentsof_type
{ typedef typename contentsof_type
::type type1; typedef typename detail::IF< is_reference
::value, const volatile typename boost::remove_reference
::type &, const volatile type1 >::RET type; }; // standard iterator traits should take care of the pointer types // but just to be on the safe side, we have the specializations here: // these work even if A is cv-qualified. template
struct contentsof_type
{ typedef A& type; }; template
struct contentsof_type
{ typedef A& type; }; template
struct contentsof_type
{ typedef A& type; }; template
struct contentsof_type
{ typedef A& type; }; template
struct contentsof_type
{ typedef A& type; }; template
struct contentsof_type
{ typedef const A& type; }; template
struct contentsof_type
{ typedef volatile A& type; }; template
struct contentsof_type
{ typedef const volatile A& type; }; } // end detail template
struct return_type_1
, A> { typedef typename plain_return_type_1< other_action
, typename detail::remove_reference_and_cv
::type >::type type1; // If no user defined specialization for A, then return the // cv qualified pointer to A typedef typename detail::IF_type< boost::is_same
::value, detail::contentsof_type< typename boost::remove_reference
::type >, detail::identity_mapping
>::type type; }; // ------------------------------------------------------------------ // binary actions --------------------------------------------------- // ------------------------------------------------------------------ // here the default case is: no user defined versions: template
struct plain_return_type_2 { typedef detail::unspecified type; }; namespace detail { // error classes class illegal_pointer_arithmetic{}; // pointer arithmetic type deductions ---------------------- // value = false means that this is not a pointer arithmetic case // value = true means, that this can be a pointer arithmetic case, but not necessarily is // This means, that for user defined operators for pointer types, say for some operator+(X, *Y), // the deductions must be coded at an earliel level (return_type_2). template
struct pointer_arithmetic_traits { static const bool value = false; }; template
struct pointer_arithmetic_traits
{ typedef typename array_to_pointer
::type>::type AP; typedef typename array_to_pointer
::type>::type BP; static const bool is_pointer_A = boost::is_pointer
::value; static const bool is_pointer_B = boost::is_pointer
::value; static const bool value = is_pointer_A || is_pointer_B; // can't add two pointers. // note, that we do not check wether the other type is valid for // addition with a pointer. // the compiler will catch it in the apply function typedef typename detail::IF< is_pointer_A && is_pointer_B, detail::return_type_deduction_failure< detail::illegal_pointer_arithmetic >, typename detail::IF
::RET >::RET type; }; template
struct pointer_arithmetic_traits
{ typedef typename array_to_pointer
::type>::type AP; typedef typename array_to_pointer
::type>::type BP; static const bool is_pointer_A = boost::is_pointer
::value; static const bool is_pointer_B = boost::is_pointer
::value; static const bool value = is_pointer_A || is_pointer_B; static const bool same_pointer_type = is_pointer_A && is_pointer_B && boost::is_same< typename boost::remove_const< typename boost::remove_pointer< typename boost::remove_const
::type >::type >::type, typename boost::remove_const< typename boost::remove_pointer< typename boost::remove_const
::type >::type >::type >::value; // ptr - ptr has type ptrdiff_t // note, that we do not check if, in ptr - B, B is // valid for subtraction with a pointer. // the compiler will catch it in the apply function typedef typename detail::IF< same_pointer_type, const std::ptrdiff_t, typename detail::IF< is_pointer_A, AP, detail::return_type_deduction_failure
>::RET >::RET type; }; } // namespace detail // -- arithmetic actions --------------------------------------------- namespace detail { template
struct return_type_2_arithmetic_phase_1; template
struct return_type_2_arithmetic_phase_2; template
struct return_type_2_arithmetic_phase_3; } // namespace detail // drop any qualifiers from the argument types within arithmetic_action template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2
, plain_A, plain_B>::type type1; // if user defined return type, do not enter the whole arithmetic deductions typedef typename detail::IF_type< boost::is_same
::value, detail::return_type_2_arithmetic_phase_1< detail::pointer_arithmetic_traits
::value, Act, A, B >, plain_return_type_2
, plain_A, plain_B> >::type type; }; namespace detail { // perform integral promotion, no pointer arithmetic template
struct return_type_2_arithmetic_phase_1 { typedef typename return_type_2_arithmetic_phase_2< typename remove_reference_and_cv
::type, typename remove_reference_and_cv
::type >::type type; }; // pointer_arithmetic template
struct return_type_2_arithmetic_phase_1
{ typedef typename pointer_arithmetic_traits
::type type; }; template
struct return_type_2_arithmetic_phase_2 { typedef typename return_type_2_arithmetic_phase_3< typename promote_to_int
::type, typename promote_to_int
::type >::type type; }; // specialization for unsigned int. // We only have to do these two specialization because the value promotion will // take care of the other cases. // The unsigned int promotion rule is this: // unsigned int to long if a long can hold all values of unsigned int, // otherwise go to unsigned long. // struct so I don't have to type this twice. struct promotion_of_unsigned_int { typedef detail::IF
::RET type; }; template<> struct return_type_2_arithmetic_phase_2
{ typedef promotion_of_unsigned_int::type type; }; template<> struct return_type_2_arithmetic_phase_2
{ typedef promotion_of_unsigned_int::type type; }; template
struct return_type_2_arithmetic_phase_3 { enum { promote_code_A_value = promote_code
::value, promote_code_B_value = promote_code
::value }; // enums for KCC typedef typename detail::IF< promote_code_A_value == -1 || promote_code_B_value == -1, detail::return_type_deduction_failure
, typename detail::IF< ((int)promote_code_A_value > (int)promote_code_B_value), A, B >::RET >::RET type; }; } // namespace detail // -- bitwise actions ------------------------------------------- // note: for integral types deuduction is similar to arithmetic actions. // drop any qualifiers from the argument types within arithmetic action template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2
, plain_A, plain_B>::type type1; // if user defined return type, do not enter type deductions typedef typename detail::IF_type< boost::is_same
::value, return_type_2
, A, B>, plain_return_type_2
, plain_A, plain_B> >::type type; // plus_action is just a random pick, has to be a concrete instance // TODO: This check is only valid for built-in types, overloaded types might // accept floating point operators // bitwise operators not defined for floating point types // these test are not strictly needed here, since the error will be caught in // the apply function BOOST_STATIC_ASSERT(!(boost::is_float
::value && boost::is_float
::value)); }; namespace detail { #ifdef BOOST_NO_TEMPLATED_STREAMS template
struct leftshift_type { typedef typename detail::IF< boost::is_convertible< typename boost::remove_reference
::type*, std::ostream* >::value, std::ostream&, typename detail::remove_reference_and_cv
::type >::RET type; }; template
struct rightshift_type { typedef typename detail::IF< boost::is_convertible< typename boost::remove_reference
::type*, std::istream* >::value, std::istream&, typename detail::remove_reference_and_cv
::type >::RET type; }; #else template
struct get_ostream_type { typedef std::basic_ostream
& type; }; template
struct get_istream_type { typedef std::basic_istream
& type; }; template
struct leftshift_type { private: typedef typename boost::remove_reference
::type plainA; public: typedef typename detail::IF_type< is_instance_of_2
::value, get_ostream_type
, //reference to the stream detail::remove_reference_and_cv
>::type type; }; template
struct rightshift_type { private: typedef typename boost::remove_reference
::type plainA; public: typedef typename detail::IF_type< is_instance_of_2
::value, get_istream_type
, //reference to the stream detail::remove_reference_and_cv
>::type type; }; #endif } // end detail // ostream template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2
, plain_A, plain_B>::type type1; // if user defined return type, do not enter type deductions typedef typename detail::IF_type< boost::is_same
::value, detail::leftshift_type
, plain_return_type_2
, plain_A, plain_B> >::type type; }; // istream template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2
, plain_A, plain_B>::type type1; // if user defined return type, do not enter type deductions typedef typename detail::IF_type< boost::is_same
::value, detail::rightshift_type
, plain_return_type_2
, plain_A, plain_B> >::type type; }; // -- logical actions ---------------------------------------- // always bool // NOTE: this may not be true for some weird user-defined types, template
struct plain_return_type_2
, A, B> { typedef bool type; }; template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2
, plain_A, plain_B>::type type; }; // -- relational actions ---------------------------------------- // always bool // NOTE: this may not be true for some weird user-defined types, template
struct plain_return_type_2
, A, B> { typedef bool type; }; template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2
, plain_A, plain_B>::type type; }; // Assingment actions ----------------------------------------------- // return type is the type of the first argument as reference // note that cv-qualifiers are preserved. // Yes, assignment operator can be const! // NOTE: this may not be true for some weird user-defined types, template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2< arithmetic_assignment_action
, plain_A, plain_B >::type type1; typedef typename detail::IF< boost::is_same
::value, typename boost::add_reference
::type, type1 >::RET type; }; template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2< bitwise_assignment_action
, plain_A, plain_B >::type type1; typedef typename detail::IF< boost::is_same
::value, typename boost::add_reference
::type, type1 >::RET type; }; template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2< other_action
, plain_A, plain_B >::type type1; typedef typename detail::IF< boost::is_same
::value, typename boost::add_reference
::type, type1 >::RET type; }; // -- other actions ---------------------------------------- // comma action ---------------------------------- // Note: this may not be true for some weird user-defined types, // NOTE! This only tries the plain_return_type_2 layer and gives // detail::unspecified as default. If no such specialization is found, the // type rule in the spcecialization of the return_type_2_prot is used // to give the type of the right argument (which can be a reference too) // (The built in operator, can return a l- or rvalue). template
struct return_type_2
, A, B> { typedef typename detail::remove_reference_and_cv
::type plain_A; typedef typename detail::remove_reference_and_cv
::type plain_B; typedef typename plain_return_type_2< other_action
, plain_A, plain_B >::type type; }; // subscript action ----------------------------------------------- namespace detail { // A and B are nonreference types template
struct subscript_type { typedef detail::unspecified type; }; template
struct subscript_type
{ typedef A& type; }; template
struct subscript_type
{ typedef A& type; }; template
struct subscript_type
{ typedef A& type; }; template
struct subscript_type
{ typedef A& type; }; template
struct subscript_type