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 David Abrahams 2001, Howard Hinnant 2001. // // 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) // // Template class numeric_traits
-- // // Supplies: // // typedef difference_type -- a type used to represent the difference // between any two values of Number. // // Support: // 1. Not all specializations are supplied // // 2. Use of specializations that are not supplied will cause a // compile-time error // // 3. Users are free to specialize numeric_traits for any type. // // 4. Right now, specializations are only supplied for integer types. // // 5. On implementations which do not supply compile-time constants in // std::numeric_limits<>, only specializations for built-in integer types // are supplied. // // 6. Handling of numbers whose range of representation is at least as // great as boost::intmax_t can cause some differences to be // unrepresentable in difference_type: // // Number difference_type // ------ --------------- // signed Number // unsigned intmax_t // // template
typename numeric_traits
::difference_type // numeric_distance(Number x, Number y) // computes (y - x), attempting to avoid overflows. // // See http://www.boost.org for most recent version including documentation. // Revision History // 11 Feb 2001 - Use BOOST_STATIC_CONSTANT (David Abrahams) // 11 Feb 2001 - Rolled back ineffective Borland-specific code // (David Abrahams) // 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but // not seeing any improvement yet (David Abrahams) // 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp // (David Abrahams) // 23 Jan 2001 - Fixed logic of difference_type selection, which was // completely wack. In the process, added digit_traits<> // to compute the number of digits in intmax_t even when // not supplied by numeric_limits<>. (David Abrahams) // 21 Jan 2001 - Created (David Abrahams) #ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901 # define BOOST_NUMERIC_TRAITS_HPP_DWA20001901 # include
# include
# include
# include
# include
# include
namespace boost { namespace detail { // Template class is_signed -- determine whether a numeric type is signed // Requires that T is constructable from the literals -1 and 0. Compile-time // error results if that requirement is not met (and thus signedness is not // likely to have meaning for that type). template
struct is_signed { #if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300 BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0))); #else BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits
::is_signed); #endif }; # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS // digit_traits - compute the number of digits in a built-in integer // type. Needed for implementations on which numeric_limits is not specialized // for intmax_t (e.g. VC6). template
struct digit_traits_select; // numeric_limits is specialized; just select that version of digits template <> struct digit_traits_select
{ template
struct traits { BOOST_STATIC_CONSTANT(int, digits = std::numeric_limits
::digits); }; }; // numeric_limits is not specialized; compute digits from sizeof(T) template <> struct digit_traits_select
{ template
struct traits { BOOST_STATIC_CONSTANT(int, digits = ( sizeof(T) * std::numeric_limits
::digits - (is_signed
::value ? 1 : 0)) ); }; }; // here's the "usable" template template
struct digit_traits { typedef digit_traits_select< ::std::numeric_limits
::is_specialized> selector; typedef typename selector::template traits
traits; BOOST_STATIC_CONSTANT(int, digits = traits::digits); }; #endif // Template class integer_traits
-- traits of various integer types // This should probably be rolled into boost::integer_traits one day, but I // need it to work without
template
struct integer_traits { # ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS private: typedef Integer integer_type; typedef std::numeric_limits
x; # if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // for some reason, MSVC asserts when it shouldn't unless we make these // local definitions BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer); BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized); BOOST_STATIC_ASSERT(is_integer); BOOST_STATIC_ASSERT(is_specialized); # endif public: typedef typename if_true<(int(x::is_signed) && (!int(x::is_bounded) // digits is the number of no-sign bits || (int(x::digits) + 1 >= digit_traits
::digits)))>::template then< Integer, typename if_true<(int(x::digits) + 1 < digit_traits
::digits)>::template then< signed int, typename if_true<(int(x::digits) + 1 < digit_traits
::digits)>::template then< signed long, // else intmax_t >::type>::type>::type difference_type; #else BOOST_STATIC_ASSERT(boost::is_integral
::value); typedef typename if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then< typename if_true<(is_signed
::value)>::template then< Integer, intmax_t >::type, typename if_true<(sizeof(Integer) < sizeof(std::ptrdiff_t))>::template then< std::ptrdiff_t, intmax_t >::type >::type difference_type; # endif }; // Right now, only supports integers, but should be expanded. template
struct numeric_traits { typedef typename integer_traits
::difference_type difference_type; }; template
typename numeric_traits
::difference_type numeric_distance(Number x, Number y) { typedef typename numeric_traits
::difference_type difference_type; return difference_type(y) - difference_type(x); } }} #endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901
numeric_traits.hpp
Page URL
File URL
Prev
35/61
Next
Download
( 6 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.