20
20
#include < memory>
21
21
22
22
#if RAPIDJSON_HAS_CXX11
23
- #include < limits>
24
23
#include < type_traits>
25
24
#endif
26
25
@@ -466,6 +465,7 @@ class StdAllocator :
466
465
467
466
typedef typename traits_type::size_type size_type;
468
467
typedef typename traits_type::difference_type difference_type;
468
+
469
469
typedef typename traits_type::value_type value_type;
470
470
typedef typename traits_type::pointer pointer;
471
471
typedef typename traits_type::const_pointer const_pointer;
@@ -484,19 +484,19 @@ class StdAllocator :
484
484
return std::addressof (r);
485
485
}
486
486
487
- size_t max_size () const RAPIDJSON_NOEXCEPT
487
+ size_type max_size () const RAPIDJSON_NOEXCEPT
488
488
{
489
- return std::numeric_limits<size_type>:: max () / sizeof (value_type );
489
+ return traits_type::max_size (* this );
490
490
}
491
491
492
492
template <typename ...Args>
493
- void construct (pointer p, Args &&...args)
493
+ void construct (pointer p, Args&&... args)
494
494
{
495
- :: new ( static_cast < void *>(p)) value_type ( std::forward<Args>(args)...);
495
+ traits_type::construct (* this , p, std::forward<Args>(args)...);
496
496
}
497
497
void destroy (pointer p)
498
498
{
499
- p-> ~T ( );
499
+ traits_type::destroy (* this , p );
500
500
}
501
501
502
502
#else // !RAPIDJSON_HAS_CXX11
@@ -513,7 +513,7 @@ class StdAllocator :
513
513
return allocator_type::address (r);
514
514
}
515
515
516
- size_t max_size () const RAPIDJSON_NOEXCEPT
516
+ size_type max_size () const RAPIDJSON_NOEXCEPT
517
517
{
518
518
return allocator_type::max_size ();
519
519
}
@@ -615,13 +615,13 @@ class StdAllocator<void, BaseAllocator> :
615
615
~StdAllocator () RAPIDJSON_NOEXCEPT
616
616
{ }
617
617
618
- typedef typename allocator_type::value_type value_type;
619
-
620
618
template <typename U>
621
619
struct rebind {
622
620
typedef StdAllocator<U, BaseAllocator> other;
623
621
};
624
622
623
+ typedef typename allocator_type::value_type value_type;
624
+
625
625
private:
626
626
template <typename , typename >
627
627
friend class StdAllocator ; // access to StdAllocator<!T>.*
0 commit comments