Don't define StdAllocator<void> from C++17.
This commit is contained in:
parent
e336667b4a
commit
6bed9b266f
@ -581,6 +581,7 @@ private:
|
|||||||
BaseAllocator baseAllocator_;
|
BaseAllocator baseAllocator_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if !RAPIDJSON_HAS_CXX17 // std::allocator<void> deprecated in C++17
|
||||||
template <typename BaseAllocator>
|
template <typename BaseAllocator>
|
||||||
class StdAllocator<void, BaseAllocator> :
|
class StdAllocator<void, BaseAllocator> :
|
||||||
public std::allocator<void>
|
public std::allocator<void>
|
||||||
@ -628,6 +629,7 @@ private:
|
|||||||
|
|
||||||
BaseAllocator baseAllocator_;
|
BaseAllocator baseAllocator_;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
RAPIDJSON_DIAG_POP
|
RAPIDJSON_DIAG_POP
|
||||||
|
@ -83,8 +83,12 @@ private:
|
|||||||
|
|
||||||
template <typename Allocator>
|
template <typename Allocator>
|
||||||
void TestStdAllocator(const Allocator& a) {
|
void TestStdAllocator(const Allocator& a) {
|
||||||
|
#if RAPIDJSON_HAS_CXX17
|
||||||
|
typedef StdAllocator<bool, Allocator> BoolAllocator;
|
||||||
|
#else
|
||||||
typedef StdAllocator<void, Allocator> VoidAllocator;
|
typedef StdAllocator<void, Allocator> VoidAllocator;
|
||||||
typedef typename VoidAllocator::template rebind<bool>::other BoolAllocator;
|
typedef typename VoidAllocator::template rebind<bool>::other BoolAllocator;
|
||||||
|
#endif
|
||||||
BoolAllocator ba(a), ba2(a);
|
BoolAllocator ba(a), ba2(a);
|
||||||
EXPECT_TRUE(ba == ba2);
|
EXPECT_TRUE(ba == ba2);
|
||||||
EXPECT_FALSE(ba!= ba2);
|
EXPECT_FALSE(ba!= ba2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user