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
// (C) Copyright Rani Sharoni 2003. // Use, modification and distribution are 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). // // See http://www.boost.org/libs/type_traits for most recent version including documentation. #ifndef BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED #define BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED #include
#include
#include
#include
#include
#include
#include
// should be the last #include #include
namespace boost { namespace detail { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) \ && !BOOST_WORKAROUND(__SUNPRO_CC , <= 0x540) \ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 243) \ && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) // The EDG version number is a lower estimate. // It is not currently known which EDG version // exactly fixes the problem. /************************************************************************* This version detects ambiguous base classes and private base classes correctly, and was devised by Rani Sharoni. Explanation by Terje Slettebo and Rani Sharoni. Let's take the multiple base class below as an example, and the following will also show why there's not a problem with private or ambiguous base class: struct B {}; struct B1 : B {}; struct B2 : B {}; struct D : private B1, private B2 {}; is_base_and_derived
::value; First, some terminology: SC - Standard conversion UDC - User-defined conversion A user-defined conversion sequence consists of an SC, followed by an UDC, followed by another SC. Either SC may be the identity conversion. When passing the default-constructed Host object to the overloaded check_sig() functions (initialization 8.5/14/4/3), we have several viable implicit conversion sequences: For "static no_type check_sig(B const volatile *, int)" we have the conversion sequences: C -> C const (SC - Qualification Adjustment) -> B const volatile* (UDC) C -> D const volatile* (UDC) -> B1 const volatile* / B2 const volatile* -> B const volatile* (SC - Conversion) For "static yes_type check_sig(D const volatile *, T)" we have the conversion sequence: C -> D const volatile* (UDC) According to 13.3.3.1/4, in context of user-defined conversion only the standard conversion sequence is considered when selecting the best viable function, so it only considers up to the user-defined conversion. For the first function this means choosing between C -> C const and C -> C, and it chooses the latter, because it's a proper subset (13.3.3.2/3/2) of the former. Therefore, we have: C -> D const volatile* (UDC) -> B1 const volatile* / B2 const volatile* -> B const volatile* (SC - Conversion) C -> D const volatile* (UDC) Here, the principle of the "shortest subsequence" applies again, and it chooses C -> D const volatile*. This shows that it doesn't even need to consider the multiple paths to B, or accessibility, as that possibility is eliminated before it could possibly cause ambiguity or access violation. If D is not derived from B, it has to choose between C -> C const -> B const volatile* for the first function, and C -> D const volatile* for the second function, which are just as good (both requires a UDC, 13.3.3.2), had it not been for the fact that "static no_type check_sig(B const volatile *, int)" is not templated, which makes C -> C const -> B const volatile* the best choice (13.3.3/1/4), resulting in "no". Also, if Host::operator B const volatile* hadn't been const, the two conversion sequences for "static no_type check_sig(B const volatile *, int)", in the case where D is derived from B, would have been ambiguous. See also http://groups.google.com/groups?selm=df893da6.0301280859.522081f7%40posting. google.com and links therein. *************************************************************************/ template
struct bd_helper { // // This VC7.1 specific workaround stops the compiler from generating // an internal compiler error when compiling with /vmg (thanks to // Aleksey Gurtovoy for figuring out the workaround). // #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310) template
static type_traits::yes_type check_sig(D const volatile *, T); static type_traits::no_type check_sig(B const volatile *, int); #else static type_traits::yes_type check_sig(D const volatile *, long); static type_traits::no_type check_sig(B const volatile * const&, int); #endif }; template
struct is_base_and_derived_impl2 { #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(push) #pragma warning(disable:6334) #endif // // May silently do the wrong thing with incomplete types // unless we trap them here: // BOOST_STATIC_ASSERT(sizeof(B) != 0); BOOST_STATIC_ASSERT(sizeof(D) != 0); struct Host { #if !BOOST_WORKAROUND(BOOST_MSVC, == 1310) operator B const volatile *() const; #else operator B const volatile * const&() const; #endif operator D const volatile *(); }; BOOST_STATIC_CONSTANT(bool, value = sizeof(bd_helper
::check_sig(Host(), 0)) == sizeof(type_traits::yes_type)); #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(pop) #endif }; #else // // broken version: // template
struct is_base_and_derived_impl2 { BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible
::value)); }; #define BOOST_BROKEN_IS_BASE_AND_DERIVED #endif template
struct is_base_and_derived_impl3 { BOOST_STATIC_CONSTANT(bool, value = false); }; template
struct is_base_and_derived_select { template
struct rebind { typedef is_base_and_derived_impl3
type; }; }; template <> struct is_base_and_derived_select
{ template
struct rebind { typedef is_base_and_derived_impl2
type; }; }; template
struct is_base_and_derived_impl { typedef typename remove_cv
::type ncvB; typedef typename remove_cv
::type ncvD; typedef is_base_and_derived_select< ::boost::is_class
::value, ::boost::is_class
::value, ::boost::is_same
::value> selector; typedef typename selector::template rebind
binder; typedef typename binder::type bound_type; BOOST_STATIC_CONSTANT(bool, value = bound_type::value); }; } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF2( is_base_and_derived , Base , Derived , (::boost::detail::is_base_and_derived_impl
::value) ) #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base&,Derived,false) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base,Derived&,false) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_and_derived,Base&,Derived&,false) #endif } // namespace boost #include
#endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED
is_base_and_derived.hpp
Page URL
File URL
Prev
36/83
Next
Download
( 7 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.