Fixes #332 ("aligned_alloc not available in C++11/14 on XCode 12")

This commit is contained in:
Ion Gaztañaga
2026-02-20 23:19:32 +01:00
parent 5b39f2bb37
commit e2278d3ab6
2 changed files with 8 additions and 9 deletions

View File

@@ -1489,7 +1489,7 @@ collect them containers and build [*Boost.Container], a library targeted to a wi
* Fixed bugs/issues:
* [@https://github.com/boostorg/container/issues/323 GitHub #323: ['"flat_tree::try_emplace UB"]].
* [@https://github.com/boostorg/container/issues/328 GitHub #328: ['"boost::container::deque stores a redundant copy of the allocator, increasing size"]].
* [@https://github.com/boostorg/container/issues/330 GitHub #330: ['"boost/container/detail/pair.hpp: partial specializations of boost::move_detail traits for std::pair break Unity (jumbo)"]].
* [@https://github.com/boostorg/container/issues/332 GitHub #332: ['"aligned_alloc not available in C++11/14 on XCode 12"]].
[endsect]

View File

@@ -21,25 +21,24 @@
// Platform detection
#if defined(_WIN32) && !defined(__CYGWIN__)
#define BOOST_CONTAINER_HAS_ALIGNED_MALLOC
#elif BOOST_CXX_VERSION >= 201703L
#define BOOST_CONTAINER_HAS_ALIGNED_ALLOC
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
//Note: in most C++ compilers __STDC_VERSION__ is not defined, but just in case
#define BOOST_CONTAINER_HAS_ALIGNED_ALLOC
#else
#include <unistd.h> //Include it to detect POSIX features
#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)
#define BOOST_CONTAINER_HAS_POSIX_MEMALIGN
#elif defined(__APPLE__)
#include <Availability.h>
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
#define BOOST_CONTAINER_HAS_ALIGNED_ALLOC
#else
#define BOOST_CONTAINER_HAS_POSIX_MEMALIGN
#endif
//All recent Apple OSes (macOS 10.6+, iOS 3.0+, tvOS 9.0+, watchOS 2.0+) support posix_memalign
#define BOOST_CONTAINER_HAS_POSIX_MEMALIGN
#elif defined(__ANDROID__)
#if (__ANDROID_API__ >= 28)
#define BOOST_CONTAINER_HAS_ALIGNED_ALLOC
#else
#define BOOST_CONTAINER_HAS_POSIX_MEMALIGN
#endif
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define BOOST_CONTAINER_HAS_ALIGNED_ALLOC
#endif
#endif