summaryrefslogtreecommitdiff
path: root/boost/align/aligned_allocator.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/align/aligned_allocator.hpp')
-rw-r--r--boost/align/aligned_allocator.hpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/boost/align/aligned_allocator.hpp b/boost/align/aligned_allocator.hpp
index b70ed54230..6d0f788952 100644
--- a/boost/align/aligned_allocator.hpp
+++ b/boost/align/aligned_allocator.hpp
@@ -1,10 +1,9 @@
/*
-(c) 2014-2015 Glen Joseph Fernandes
-<glenjofe -at- gmail.com>
+Copyright 2014-2015 Glen Joseph Fernandes
+(glenjofe@gmail.com)
-Distributed under the Boost Software
-License, Version 1.0.
-http://boost.org/LICENSE_1_0.txt
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP
#define BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP
@@ -74,12 +73,12 @@ public:
}
pointer allocate(size_type size, const_void_pointer = 0) {
- void* p = 0;
- if (size > 0) {
- p = aligned_alloc(min_align, sizeof(T) * size);
- if (!p) {
- boost::throw_exception(std::bad_alloc());
- }
+ if (size == 0) {
+ return 0;
+ }
+ void* p = aligned_alloc(min_align, sizeof(T) * size);
+ if (!p) {
+ boost::throw_exception(std::bad_alloc());
}
return static_cast<T*>(p);
}
@@ -139,21 +138,23 @@ public:
};
};
-template<class T1, class T2, std::size_t Alignment>
-inline bool operator==(const aligned_allocator<T1, Alignment>&,
- const aligned_allocator<T2, Alignment>&) BOOST_NOEXCEPT
+template<class T, class U, std::size_t Alignment>
+inline bool
+operator==(const aligned_allocator<T, Alignment>&,
+ const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT
{
return true;
}
-template<class T1, class T2, std::size_t Alignment>
-inline bool operator!=(const aligned_allocator<T1, Alignment>&,
- const aligned_allocator<T2, Alignment>&) BOOST_NOEXCEPT
+template<class T, class U, std::size_t Alignment>
+inline bool
+operator!=(const aligned_allocator<T, Alignment>&,
+ const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT
{
return false;
}
-} /* .alignment */
-} /* .boost */
+} /* alignment */
+} /* boost */
#endif