diff --git a/include/rapidjson/allocators.h b/include/rapidjson/allocators.h index 4265214..2871542 100644 --- a/include/rapidjson/allocators.h +++ b/include/rapidjson/allocators.h @@ -20,7 +20,6 @@ #include #if RAPIDJSON_HAS_CXX11 -#include #include #endif @@ -466,6 +465,7 @@ public: typedef typename traits_type::size_type size_type; typedef typename traits_type::difference_type difference_type; + typedef typename traits_type::value_type value_type; typedef typename traits_type::pointer pointer; typedef typename traits_type::const_pointer const_pointer; @@ -484,19 +484,19 @@ public: return std::addressof(r); } - size_t max_size() const RAPIDJSON_NOEXCEPT + size_type max_size() const RAPIDJSON_NOEXCEPT { - return std::numeric_limits::max() / sizeof(value_type); + return traits_type::max_size(*this); } template - void construct(pointer p, Args &&...args) + void construct(pointer p, Args&&... args) { - ::new (static_cast(p)) value_type(std::forward(args)...); + traits_type::construct(*this, p, std::forward(args)...); } void destroy(pointer p) { - p->~T(); + traits_type::destroy(*this, p); } #else // !RAPIDJSON_HAS_CXX11 @@ -513,7 +513,7 @@ public: return allocator_type::address(r); } - size_t max_size() const RAPIDJSON_NOEXCEPT + size_type max_size() const RAPIDJSON_NOEXCEPT { return allocator_type::max_size(); } @@ -615,13 +615,13 @@ public: ~StdAllocator() RAPIDJSON_NOEXCEPT { } - typedef typename allocator_type::value_type value_type; - template struct rebind { typedef StdAllocator other; }; + typedef typename allocator_type::value_type value_type; + private: template friend class StdAllocator; // access to StdAllocator.* diff --git a/include/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h index 8dcb0a0..1093581 100644 --- a/include/rapidjson/rapidjson.h +++ b/include/rapidjson/rapidjson.h @@ -135,6 +135,8 @@ #define RAPIDJSON_CPLUSPLUS __cplusplus #endif +//!@endcond + /////////////////////////////////////////////////////////////////////////////// // RAPIDJSON_HAS_STDSTRING @@ -627,10 +629,14 @@ RAPIDJSON_NAMESPACE_END #if RAPIDJSON_HAS_CXX17 # define RAPIDJSON_DELIBERATE_FALLTHROUGH [[fallthrough]] -#elif defined(__has_cpp_attribute) && __has_cpp_attribute(fallthrough) -# define RAPIDJSON_DELIBERATE_FALLTHROUGH __attribute__((fallthrough)) -#elif defined(__has_cpp_attribute) && __has_cpp_attribute(clang::fallthrough) -# define RAPIDJSON_DELIBERATE_FALLTHROUGH [[clang::fallthrough]] +#elif defined(__has_cpp_attribute) +# if __has_cpp_attribute(clang::fallthrough) +# define RAPIDJSON_DELIBERATE_FALLTHROUGH [[clang::fallthrough]] +# elif __has_cpp_attribute(fallthrough) +# define RAPIDJSON_DELIBERATE_FALLTHROUGH __attribute__((fallthrough)) +# else +# define RAPIDJSON_DELIBERATE_FALLTHROUGH +# endif #else # define RAPIDJSON_DELIBERATE_FALLTHROUGH #endif