Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions include/boost/core/allocator_access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
#if defined(_STL_DISABLE_DEPRECATED_WARNING)
_STL_DISABLE_DEPRECATED_WARNING
#endif
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4996)
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated-declarations")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
# endif
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4996)
#elif defined(BOOST_GCC) && BOOST_GCC >= 40600
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

namespace boost {
Expand Down Expand Up @@ -807,9 +815,15 @@ using allocator_rebind_t = typename allocator_rebind<A, T>::type;

} /* boost */

#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated-declarations")
# pragma clang diagnostic pop
# endif
#elif defined(_MSC_VER)
# pragma warning(pop)
#elif defined(BOOST_GCC) && BOOST_GCC >= 40600
# pragma GCC diagnostic pop
#endif
#if defined(_STL_RESTORE_DEPRECATED_WARNING)
_STL_RESTORE_DEPRECATED_WARNING
#endif
Expand Down
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ run allocator_destroy_test.cpp ;
run allocator_construct_n_test.cpp ;
run allocator_destroy_n_test.cpp ;
run allocator_traits_test.cpp ;
compile allocator_pmr_test.cpp ;

lib lib_typeid : lib_typeid.cpp : <link>shared:<define>LIB_TYPEID_DYN_LINK=1 ;

Expand Down
22 changes: 22 additions & 0 deletions test/allocator_pmr_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Testing stdlib polymorphic allocators
//
// Copyright 2024 Braden Ganetsky
//
// 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
//

#include <boost/core/allocator_access.hpp>
#include <boost/config.hpp>

#ifndef BOOST_NO_CXX17_HDR_MEMORY_RESOURCE
#include <memory_resource>

void pmr_allocator_destroy_compiles(std::pmr::polymorphic_allocator<int>& alloc, int* p)
{
boost::allocator_destroy(alloc, p);
}

#endif // !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)