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 Gennadiy Rozental 2004-2007. // 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) // See http://www.boost.org/libs/test for the library home page. // // File : $RCSfile$ // // Version : $Revision: 41369 $ // // Description : addition to STL algorithms // *************************************************************************** #ifndef BOOST_ALGORITHM_HPP_062304GER #define BOOST_ALGORITHM_HPP_062304GER #include
#include
// std::find #include
// std::bind1st #include
//____________________________________________________________________________// namespace boost { namespace unit_test { /// @brief this algorithm search through two collections for first mismatch position that get returned as a pair /// of iterators, first pointing to the mismatch position in first collection, second iterator in second one /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template
inline std::pair
mismatch( InputIter1 first1, InputIter1 last1, InputIter2 first2, InputIter2 last2 ) { while( first1 != last1 && first2 != last2 && *first1 == *first2 ) { ++first1; ++first2; } return std::pair
(first1, first2); } //____________________________________________________________________________// /// @brief this algorithm search through two collections for first mismatch position that get returned as a pair /// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms /// uses supplied predicate for collection elements comparison /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator /// @param pred - predicate to be used for search template
inline std::pair
mismatch( InputIter1 first1, InputIter1 last1, InputIter2 first2, InputIter2 last2, Predicate pred ) { while( first1 != last1 && first2 != last2 && pred( *first1, *first2 ) ) { ++first1; ++first2; } return std::pair
(first1, first2); } //____________________________________________________________________________// /// @brief this algorithm search through first collection for first element that does not belong a second one /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template
inline ForwardIterator1 find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { while( first1 != last1 ) { if( std::find( first2, last2, *first1 ) == last2 ) break; ++first1; } return first1; } //____________________________________________________________________________// /// @brief this algorithm search through first collection for first element that does not satisfy binary /// predicate in conjunction will any element in second collection /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator /// @param pred - predicate to be used for search template
inline ForwardIterator1 find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, Predicate pred ) { while( first1 != last1 ) { if( std::find_if( first2, last2, std::bind1st( pred, *first1 ) ) == last2 ) break; ++first1; } return first1; } //____________________________________________________________________________// /// @brief this algorithm search through first collection for last element that belongs to a second one /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template
inline BidirectionalIterator1 find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { if( first1 == last1 || first2 == last2 ) return last1; BidirectionalIterator1 it1 = last1; while( --it1 != first1 && std::find( first2, last2, *it1 ) == last2 ) {} return it1 == first1 && std::find( first2, last2, *it1 ) == last2 ? last1 : it1; } //____________________________________________________________________________// /// @brief this algorithm search through first collection for last element that satisfy binary /// predicate in conjunction will at least one element in second collection /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator /// @param pred - predicate to be used for search template
inline BidirectionalIterator1 find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, Predicate pred ) { if( first1 == last1 || first2 == last2 ) return last1; BidirectionalIterator1 it1 = last1; while( --it1 != first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ) {} return it1 == first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ? last1 : it1; } //____________________________________________________________________________// /// @brief this algorithm search through first collection for last element that does not belong to a second one /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template
inline BidirectionalIterator1 find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { if( first1 == last1 || first2 == last2 ) return last1; BidirectionalIterator1 it1 = last1; while( --it1 != first1 && std::find( first2, last2, *it1 ) != last2 ) {} return it1 == first1 && std::find( first2, last2, *it1 ) != last2 ? last1 : it1; } //____________________________________________________________________________// /// @brief this algorithm search through first collection for last element that does not satisfy binary /// predicate in conjunction will any element in second collection /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator /// @param pred - predicate to be used for search template
inline BidirectionalIterator1 find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, Predicate pred ) { if( first1 == last1 || first2 == last2 ) return last1; BidirectionalIterator1 it1 = last1; while( --it1 != first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) != last2 ) {} return it1 == first1 && std::find_if( first2, last2, std::bind1st( pred, *it1 ) ) == last2 ? last1 : it1; } //____________________________________________________________________________// } // namespace unit_test } // namespace boost //____________________________________________________________________________// #include
#endif // BOOST_ALGORITHM_HPP_062304GER
algorithm.hpp
Page URL
File URL
Prev 1/13
Next
Download
( 8 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.