mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:43:03 +01:00
PoolAllocator: fix VS 2017 build.
This commit is contained in:
parent
4c9fffd9b9
commit
652ebe49ff
@ -469,6 +469,10 @@ namespace Firebird
|
|||||||
using size_type = size_t;
|
using size_type = size_t;
|
||||||
using pointer = T*;
|
using pointer = T*;
|
||||||
using const_pointer = const T*;
|
using const_pointer = const T*;
|
||||||
|
using reference = T&;
|
||||||
|
using const_reference = const T&;
|
||||||
|
using void_pointer = void* ;
|
||||||
|
using const_void_pointer = const void*;
|
||||||
using difference_type = std::ptrdiff_t;
|
using difference_type = std::ptrdiff_t;
|
||||||
using is_always_equal = std::true_type;
|
using is_always_equal = std::true_type;
|
||||||
|
|
||||||
@ -511,12 +515,37 @@ namespace Firebird
|
|||||||
return size_t(-1) / sizeof(T);
|
return size_t(-1) / sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* C++17
|
||||||
template <typename U, typename... Args>
|
template <typename U, typename... Args>
|
||||||
constexpr void construct(U* ptr, Args&&... args)
|
constexpr void construct(U* ptr, Args&&... args)
|
||||||
|
{
|
||||||
|
if constexpr (std::is_constructible<U, MemoryPool&, Args...>::value)
|
||||||
|
new ((void*) ptr) U(pool, std::forward<Args>(args)...);
|
||||||
|
else
|
||||||
|
new ((void*) ptr) U(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename U,
|
||||||
|
typename... Args,
|
||||||
|
std::enable_if_t<std::is_constructible<U, MemoryPool&, Args...>::value, bool> = true
|
||||||
|
>
|
||||||
|
constexpr void construct(U* ptr, Args&&... args)
|
||||||
{
|
{
|
||||||
new ((void*) ptr) U(pool, std::forward<Args>(args)...);
|
new ((void*) ptr) U(pool, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
typename U,
|
||||||
|
typename... Args,
|
||||||
|
std::enable_if_t<!std::is_constructible<U, MemoryPool&, Args...>::value, bool> = true
|
||||||
|
>
|
||||||
|
constexpr void construct(U* ptr, Args&&... args)
|
||||||
|
{
|
||||||
|
new ((void*) ptr) U(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename U>
|
template <typename U>
|
||||||
constexpr void destroy(U* ptr)
|
constexpr void destroy(U* ptr)
|
||||||
{
|
{
|
||||||
@ -548,8 +577,8 @@ struct std::allocator_traits<Firebird::PoolAllocator<TAlloc>>
|
|||||||
using value_type = typename Alloc::value_type;
|
using value_type = typename Alloc::value_type;
|
||||||
using pointer = typename Alloc::pointer;
|
using pointer = typename Alloc::pointer;
|
||||||
using const_pointer = typename Alloc::const_pointer;
|
using const_pointer = typename Alloc::const_pointer;
|
||||||
using void_pointer = void*;
|
using void_pointer = typename Alloc::void_pointer;
|
||||||
using const_void_pointer = const void*;
|
using const_void_pointer = typename Alloc::const_void_pointer;
|
||||||
using size_type = typename Alloc::size_type;
|
using size_type = typename Alloc::size_type;
|
||||||
using difference_type = typename Alloc::difference_type;
|
using difference_type = typename Alloc::difference_type;
|
||||||
using reference = value_type&;
|
using reference = value_type&;
|
||||||
|
Loading…
Reference in New Issue
Block a user