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
// boost\math\tools\promotion.hpp // Copyright John Maddock 2006. // Copyright Paul A. Bristow 2006. // 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) // Promote arguments functions to allow math functions to have arguments // provided as integer OR real (floating-point, built-in or UDT) // (called ArithmeticType in functions that use promotion) // that help to reduce the risk of creating multiple instantiations. // Allows creation of an inline wrapper that forwards to a foo(RT, RT) function, // so you never get to instantiate any mixed foo(RT, IT) functions. #ifndef BOOST_MATH_PROMOTION_HPP #define BOOST_MATH_PROMOTION_HPP // Boost type traits: #include
#include
// for boost::is_floating_point; #include
// for boost::is_integral #include
// for boost::is_convertible #include
// for boost::is_same #include
// for boost::remove_cv // Boost Template meta programming: #include
// for boost::mpl::if_c. #include
// for boost::mpl::if_c. #include
// for boost::mpl::if_c. #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS #include
#endif namespace boost { namespace math { namespace tools { // If either T1 or T2 is an integer type, // pretend it was a double (for the purposes of further analysis). // Then pick the wider of the two floating-point types // as the actual signature to forward to. // For example: // foo(int, short) -> double foo(double, double); // foo(int, float) -> double foo(double, double); // Note: NOT float foo(float, float) // foo(int, double) -> foo(double, double); // foo(double, float) -> double foo(double, double); // foo(double, float) -> double foo(double, double); // foo(any-int-or-float-type, long double) -> foo(long double, long double); // but ONLY float foo(float, float) is unchanged. // So the only way to get an entirely float version is to call foo(1.F, 2.F), // But since most (all?) the math functions convert to double internally, // probably there would not be the hoped-for gain by using float here. // This follows the C-compatible conversion rules of pow, etc // where pow(int, float) is converted to pow(double, double). template
struct promote_arg { // If T is integral type, then promote to double. typedef typename mpl::if_
, double, T>::type type; }; template
struct promote_args_2 { // Promote, if necessary, & pick the wider of the two floating-point types. // for both parameter types, if integral promote to double. typedef typename promote_arg
::type T1P; // T1 perhaps promoted. typedef typename promote_arg
::type T2P; // T2 perhaps promoted. typedef typename mpl::if_< typename mpl::and_
, is_floating_point
>::type, // both T1P and T2P are floating-point? typename mpl::if_< typename mpl::or_
, is_same
>::type, // either long double? long double, // then result type is long double. typename mpl::if_< typename mpl::or_
, is_same
>::type, // either double? double, // result type is double. float // else result type is float. >::type >::type, // else one or the other is a user-defined type: typename mpl::if_< ::boost::is_convertible
, T2P, T1P>::type>::type type; }; // promote_arg2 template
struct promote_args { typedef typename promote_args_2< typename remove_cv
::type, typename promote_args_2< typename remove_cv
::type, typename promote_args_2< typename remove_cv
::type, typename promote_args_2< typename remove_cv
::type, typename promote_args_2< typename remove_cv
::type, typename remove_cv
::type >::type >::type >::type >::type >::type type; #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS // // Guard against use of long double if it's not supported: // BOOST_STATIC_ASSERT((0 == ::boost::is_same
::value)); #endif }; } // namespace tools } // namespace math } // namespace boost #endif // BOOST_MATH_PROMOTION_HPP
promotion.hpp
Page URL
File URL
Prev
6/19
Next
Download
( 5 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.