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 interval/utility.hpp template implementation file * * Copyright 2000 Jens Maurer * Copyright 2002-2003 Herv� Br�nnimann, Guillaume Melquiond, Sylvain Pion * * 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) */ #ifndef BOOST_NUMERIC_INTERVAL_UTILITY_HPP #define BOOST_NUMERIC_INTERVAL_UTILITY_HPP #include
#include
#include
#include
#include
#include
/* * Implementation of simple functions */ namespace boost { namespace numeric { /* * Utility Functions */ template
inline const T& lower(const interval
& x) { return x.lower(); } template
inline const T& upper(const interval
& x) { return x.upper(); } template
inline T checked_lower(const interval
& x) { if (empty(x)) { typedef typename Policies::checking checking; return checking::nan(); } return x.lower(); } template
inline T checked_upper(const interval
& x) { if (empty(x)) { typedef typename Policies::checking checking; return checking::nan(); } return x.upper(); } template
inline T width(const interval
& x) { if (interval_lib::detail::test_input(x)) return static_cast
(0); typename Policies::rounding rnd; return rnd.sub_up(x.upper(), x.lower()); } template
inline T median(const interval
& x) { if (interval_lib::detail::test_input(x)) { typedef typename Policies::checking checking; return checking::nan(); } typename Policies::rounding rnd; return rnd.median(x.lower(), x.upper()); } template
inline interval
widen(const interval
& x, const T& v) { if (interval_lib::detail::test_input(x)) return interval
::empty(); typename Policies::rounding rnd; return interval
(rnd.sub_down(x.lower(), v), rnd.add_up (x.upper(), v), true); } /* * Set-like operations */ template
inline bool empty(const interval
& x) { return interval_lib::detail::test_input(x); } template
inline bool zero_in(const interval
& x) { if (interval_lib::detail::test_input(x)) return false; return (!interval_lib::user::is_pos(x.lower())) && (!interval_lib::user::is_neg(x.upper())); } template
inline bool in_zero(const interval
& x) // DEPRECATED { return zero_in
(x); } template
inline bool in(const T& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return false; return y.lower() <= x && x <= y.upper(); } template
inline bool subset(const interval
& x, const interval
& y) { if (empty(x)) return true; return !empty(y) && y.lower() <= x.lower() && x.upper() <= y.upper(); } template
inline bool proper_subset(const interval
& x, const interval
& y) { if (empty(y)) return false; if (empty(x)) return true; return y.lower() <= x.lower() && x.upper() <= y.upper() && (y.lower() != x.lower() || x.upper() != y.upper()); } template
inline bool overlap(const interval
& x, const interval
& y) { if (interval_lib::detail::test_input(x, y)) return false; return x.lower() <= y.lower() && y.lower() <= x.upper() || y.lower() <= x.lower() && x.lower() <= y.upper(); } template
inline bool singleton(const interval
& x) { return !empty(x) && x.lower() == x.upper(); } template
inline bool equal(const interval
& x, const interval
& y) { if (empty(x)) return empty(y); return !empty(y) && x.lower() == y.lower() && x.upper() == y.upper(); } template
inline interval
intersect(const interval
& x, const interval
& y) { BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); if (interval_lib::detail::test_input(x, y)) return interval
::empty(); const T& l = max BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y.lower()); const T& u = min BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y.upper()); if (l <= u) return interval
(l, u, true); else return interval
::empty(); } template
inline interval
hull(const interval
& x, const interval
& y) { BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); bool bad_x = interval_lib::detail::test_input(x); bool bad_y = interval_lib::detail::test_input(y); if (bad_x) if (bad_y) return interval
::empty(); else return y; else if (bad_y) return x; return interval
(min BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y.lower()), max BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y.upper()), true); } template
inline interval
hull(const interval
& x, const T& y) { BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); bool bad_x = interval_lib::detail::test_input(x); bool bad_y = interval_lib::detail::test_input
(y); if (bad_y) if (bad_x) return interval
::empty(); else return x; else if (bad_x) return interval
(y, y, true); return interval
(min BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y), max BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y), true); } template
inline interval
hull(const T& x, const interval
& y) { BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); bool bad_x = interval_lib::detail::test_input
(x); bool bad_y = interval_lib::detail::test_input(y); if (bad_x) if (bad_y) return interval
::empty(); else return y; else if (bad_y) return interval
(x, x, true); return interval
(min BOOST_PREVENT_MACRO_SUBSTITUTION(x, y.lower()), max BOOST_PREVENT_MACRO_SUBSTITUTION(x, y.upper()), true); } template
inline interval
hull(const T& x, const T& y) { return interval
::hull(x, y); } template
inline std::pair
, interval
> bisect(const interval
& x) { typedef interval
I; if (interval_lib::detail::test_input(x)) return std::pair
(I::empty(), I::empty()); const T m = median(x); return std::pair
(I(x.lower(), m, true), I(m, x.upper(), true)); } /* * Elementary functions */ template
inline T norm(const interval
& x) { typedef interval
I; if (interval_lib::detail::test_input(x)) { typedef typename Policies::checking checking; return checking::nan(); } BOOST_USING_STD_MAX(); return max BOOST_PREVENT_MACRO_SUBSTITUTION(static_cast
(-x.lower()), x.upper()); } template
inline interval
abs(const interval
& x) { typedef interval
I; if (interval_lib::detail::test_input(x)) return I::empty(); if (!interval_lib::user::is_neg(x.lower())) return x; if (!interval_lib::user::is_pos(x.upper())) return -x; BOOST_USING_STD_MAX(); return I(static_cast
(0), max BOOST_PREVENT_MACRO_SUBSTITUTION(static_cast
(-x.lower()), x.upper()), true); } template
inline interval
max BOOST_PREVENT_MACRO_SUBSTITUTION (const interval
& x, const interval
& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); BOOST_USING_STD_MAX(); return I(max BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y.lower()), max BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y.upper()), true); } template
inline interval
max BOOST_PREVENT_MACRO_SUBSTITUTION (const interval
& x, const T& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); BOOST_USING_STD_MAX(); return I(max BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y), max BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y), true); } template
inline interval
max BOOST_PREVENT_MACRO_SUBSTITUTION (const T& x, const interval
& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); BOOST_USING_STD_MAX(); return I(max BOOST_PREVENT_MACRO_SUBSTITUTION(x, y.lower()), max BOOST_PREVENT_MACRO_SUBSTITUTION(x, y.upper()), true); } template
inline interval
min BOOST_PREVENT_MACRO_SUBSTITUTION (const interval
& x, const interval
& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); BOOST_USING_STD_MIN(); return I(min BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y.lower()), min BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y.upper()), true); } template
inline interval
min BOOST_PREVENT_MACRO_SUBSTITUTION (const interval
& x, const T& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); BOOST_USING_STD_MIN(); return I(min BOOST_PREVENT_MACRO_SUBSTITUTION(x.lower(), y), min BOOST_PREVENT_MACRO_SUBSTITUTION(x.upper(), y), true); } template
inline interval
min BOOST_PREVENT_MACRO_SUBSTITUTION (const T& x, const interval
& y) { typedef interval
I; if (interval_lib::detail::test_input(x, y)) return I::empty(); BOOST_USING_STD_MIN(); return I(min BOOST_PREVENT_MACRO_SUBSTITUTION(x, y.lower()), min BOOST_PREVENT_MACRO_SUBSTITUTION(x, y.upper()), true); } } // namespace numeric } // namespace boost #endif // BOOST_NUMERIC_INTERVAL_UTILITY_HPP
utility.hpp
Page URL
File URL
Prev
16/16 Next
Download
( 10 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.