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
// Copyright (C) 2006 Douglas Gregor
// Use, modification and distribution is 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) /** @file allocator.hpp * * This header provides an STL-compliant allocator that uses the * MPI-2 memory allocation facilities. */ #ifndef BOOST_MPI_ALLOCATOR_HPP #define BOOST_MPI_ALLOCATOR_HPP #include
#include
#include
#include
#include
namespace boost { namespace mpi { #if defined(BOOST_MPI_HAS_MEMORY_ALLOCATION) template
class allocator; /** @brief Allocator specialization for @c void value types. * * The @c void specialization of @c allocator is useful only for * rebinding to another, different value type. */ template<> class BOOST_MPI_DECL allocator
{ public: typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template
struct rebind { typedef allocator
other; }; }; /** @brief Standard Library-compliant allocator for the MPI-2 memory * allocation routines. * * This allocator provides a standard C++ interface to the @c * MPI_Alloc_mem and @c MPI_Free_mem routines of MPI-2. It is * intended to be used with the containers in the Standard Library * (@c vector, in particular) in cases where the contents of the * container will be directly transmitted via MPI. This allocator is * also used internally by the library for character buffers that * will be used in the transmission of data. * * The @c allocator class template only provides MPI memory * allocation when the underlying MPI implementation is either MPI-2 * compliant or is known to provide @c MPI_Alloc_mem and @c * MPI_Free_mem as extensions. When the MPI memory allocation * routines are not available, @c allocator is brought in directly * from namespace @c std, so that standard allocators are used * throughout. The macro @c BOOST_MPI_HAS_MEMORY_ALLOCATION will be * defined when the MPI-2 memory allocation facilities are available. */ template
class BOOST_MPI_DECL allocator { public: /// Holds the size of objects typedef std::size_t size_type; /// Holds the number of elements between two pointers typedef std::ptrdiff_t difference_type; /// A pointer to an object of type @c T typedef T* pointer; /// A pointer to a constant object of type @c T typedef const T* const_pointer; /// A reference to an object of type @c T typedef T& reference; /// A reference to a constant object of type @c T typedef const T& const_reference; /// The type of memory allocated by this allocator typedef T value_type; /** @brief Retrieve the type of an allocator similar to this * allocator but for a different value type. */ template
struct rebind { typedef allocator
other; }; /** Default-construct an allocator. */ allocator() throw() { } /** Copy-construct an allocator. */ allocator(const allocator&) throw() { } /** * Copy-construct an allocator from another allocator for a * different value type. */ template
allocator(const allocator
&) throw() { } /** Destroy an allocator. */ ~allocator() throw() { } /** Returns the address of object @p x. */ pointer address(reference x) const { return &x; } /** Returns the address of object @p x. */ const_pointer address(const_reference x) const { return &x; } /** * Allocate enough memory for @p n elements of type @c T. * * @param n The number of elements for which memory should be * allocated. * * @return a pointer to the newly-allocated memory */ pointer allocate(size_type n, allocator
::const_pointer /*hint*/ = 0) { pointer result; BOOST_MPI_CHECK_RESULT(MPI_Alloc_mem, (static_cast
(n * sizeof(T)), MPI_INFO_NULL, &result)); return result; } /** * Deallocate memory referred to by the pointer @c p. * * @param p The pointer whose memory should be deallocated. This * pointer shall have been returned from the @c allocate() function * and not have already been freed. */ void deallocate(pointer p, size_type /*n*/) { BOOST_MPI_CHECK_RESULT(MPI_Free_mem, (p)); } /** * Returns the maximum number of elements that can be allocated * with @c allocate(). */ size_type max_size() const throw() { return (std::numeric_limits
::max)() / sizeof(T); } /** Construct a copy of @p val at the location referenced by @c p. */ void construct(pointer p, const T& val) { new ((void *)p) T(val); } /** Destroy the object referenced by @c p. */ void destroy(pointer p) { ((T*)p)->~T(); } }; /** @brief Compare two allocators for equality. * * Since MPI allocators have no state, all MPI allocators are equal. * * @returns @c true */ template
inline bool operator==(const allocator
&, const allocator
&) throw() { return true; } /** @brief Compare two allocators for inequality. * * Since MPI allocators have no state, all MPI allocators are equal. * * @returns @c false */ template
inline bool operator!=(const allocator
&, const allocator
&) throw() { return false; } #else // Bring in the default allocator from namespace std. using std::allocator; #endif } } /// end namespace boost::mpi #endif // BOOST_MPI_ALLOCATOR_HPP
allocator.hpp
Page URL
File URL
Prev 1/22
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.