Commit 3679c280 authored by Milo Yip's avatar Milo Yip

Merge remote-tracking branch 'origin/master' into issue120floatprecision_customstrtod

parents 57b91300 c8bed6b8
...@@ -1862,6 +1862,8 @@ private: ...@@ -1862,6 +1862,8 @@ private:
} }
private: private:
//! Prohibit copying
GenericDocument(const GenericDocument&);
//! Prohibit assignment //! Prohibit assignment
GenericDocument& operator=(const GenericDocument&); GenericDocument& operator=(const GenericDocument&);
......
...@@ -43,7 +43,7 @@ RAPIDJSON_DIAG_OFF(effc++) ...@@ -43,7 +43,7 @@ RAPIDJSON_DIAG_OFF(effc++)
struct DiyFp { struct DiyFp {
DiyFp() {} DiyFp() {}
DiyFp(uint64_t f, int e) : f(f), e(e) {} DiyFp(uint64_t fp, int exp) : f(fp), e(exp) {}
explicit DiyFp(double d) { explicit DiyFp(double d) {
union { union {
......
...@@ -59,12 +59,14 @@ public: ...@@ -59,12 +59,14 @@ public:
//! Constructor //! Constructor
/*! \param os Output stream. /*! \param os Output stream.
\param allocator User supplied allocator. If it is null, it will create a private one. \param stackAllocator User supplied allocator. If it is null, it will create a private one.
\param levelDepth Initial capacity of stack. \param levelDepth Initial capacity of stack.
*/ */
explicit
Writer(OutputStream& os, StackAllocator* stackAllocator = 0, size_t levelDepth = kDefaultLevelDepth) : Writer(OutputStream& os, StackAllocator* stackAllocator = 0, size_t levelDepth = kDefaultLevelDepth) :
os_(&os), level_stack_(stackAllocator, levelDepth * sizeof(Level)), hasRoot_(false) {} os_(&os), level_stack_(stackAllocator, levelDepth * sizeof(Level)), hasRoot_(false) {}
explicit
Writer(StackAllocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) : Writer(StackAllocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) :
os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), hasRoot_(false) {} os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), hasRoot_(false) {}
......
...@@ -97,4 +97,4 @@ The following diagram shows the process. ...@@ -97,4 +97,4 @@ The following diagram shows the process.
![simpledom](doc/diagram/simpledom.png) ![simpledom](doc/diagram/simpledom.png)
More [examples](example/) are available. More [examples](https://github.com/miloyip/rapidjson/tree/master/example) are available.
...@@ -232,26 +232,38 @@ TEST(Document, UTF16_Document) { ...@@ -232,26 +232,38 @@ TEST(Document, UTF16_Document) {
#include <type_traits> #include <type_traits>
TEST(Document, Traits) { TEST(Document, Traits) {
static_assert( std::is_constructible<Document>::value, ""); static_assert(std::is_constructible<Document>::value, "");
static_assert( std::is_default_constructible<Document>::value, ""); static_assert(std::is_default_constructible<Document>::value, "");
static_assert(!std::is_copy_constructible<Document>::value, ""); #ifndef _MSC_VER
static_assert( std::is_move_constructible<Document>::value, ""); static_assert(!std::is_copy_constructible<Document>::value, "");
#endif
static_assert(!std::is_nothrow_constructible<Document>::value, ""); static_assert(std::is_move_constructible<Document>::value, "");
static_assert(!std::is_nothrow_default_constructible<Document>::value, "");
static_assert(!std::is_nothrow_copy_constructible<Document>::value, ""); static_assert(!std::is_nothrow_constructible<Document>::value, "");
static_assert( std::is_nothrow_move_constructible<Document>::value, ""); static_assert(!std::is_nothrow_default_constructible<Document>::value, "");
static_assert(!std::is_nothrow_copy_constructible<Document>::value, "");
static_assert( std::is_assignable<Document,Document>::value, ""); #ifndef _MSC_VER
static_assert(std::is_nothrow_move_constructible<Document>::value, "");
#endif
static_assert(std::is_assignable<Document,Document>::value, "");
#ifndef _MSC_VER
static_assert(!std::is_copy_assignable<Document>::value, ""); static_assert(!std::is_copy_assignable<Document>::value, "");
static_assert( std::is_move_assignable<Document>::value, ""); #endif
static_assert(std::is_move_assignable<Document>::value, "");
static_assert( std::is_nothrow_assignable<Document,Document>::value, "");
static_assert(!std::is_nothrow_copy_assignable<Document>::value, ""); #ifndef _MSC_VER
static_assert( std::is_nothrow_move_assignable<Document>::value, ""); static_assert(std::is_nothrow_assignable<Document, Document>::value, "");
#endif
static_assert( std::is_destructible<Document>::value, ""); static_assert(!std::is_nothrow_copy_assignable<Document>::value, "");
static_assert( std::is_nothrow_destructible<Document>::value, ""); #ifndef _MSC_VER
static_assert(std::is_nothrow_move_assignable<Document>::value, "");
#endif
static_assert( std::is_destructible<Document>::value, "");
#ifndef _MSC_VER
static_assert(std::is_nothrow_destructible<Document>::value, "");
#endif
} }
template <typename Allocator> template <typename Allocator>
......
...@@ -43,27 +43,41 @@ TEST(Value, DefaultConstructor) { ...@@ -43,27 +43,41 @@ TEST(Value, DefaultConstructor) {
#include <type_traits> #include <type_traits>
TEST(Value, Traits) { TEST(Value, Traits) {
typedef GenericValue<UTF8<>, CrtAllocator> Value; typedef GenericValue<UTF8<>, CrtAllocator> Value;
static_assert( std::is_constructible<Value>::value, ""); static_assert(std::is_constructible<Value>::value, "");
static_assert( std::is_default_constructible<Value>::value, ""); static_assert(std::is_default_constructible<Value>::value, "");
static_assert(!std::is_copy_constructible<Value>::value, ""); #ifndef _MSC_VER
static_assert( std::is_move_constructible<Value>::value, ""); static_assert(!std::is_copy_constructible<Value>::value, "");
#endif
static_assert( std::is_nothrow_constructible<Value>::value, ""); static_assert(std::is_move_constructible<Value>::value, "");
static_assert( std::is_nothrow_default_constructible<Value>::value, "");
static_assert(!std::is_nothrow_copy_constructible<Value>::value, ""); #ifndef _MSC_VER
static_assert( std::is_nothrow_move_constructible<Value>::value, ""); static_assert(std::is_nothrow_constructible<Value>::value, "");
static_assert(std::is_nothrow_default_constructible<Value>::value, "");
static_assert( std::is_assignable<Value,Value>::value, ""); #endif
static_assert(!std::is_copy_assignable<Value>::value, ""); static_assert(!std::is_nothrow_copy_constructible<Value>::value, "");
static_assert( std::is_move_assignable<Value>::value, ""); #ifndef _MSC_VER
static_assert(std::is_nothrow_move_constructible<Value>::value, "");
static_assert( std::is_nothrow_assignable<Value,Value>::value, ""); #endif
static_assert(!std::is_nothrow_copy_assignable<Value>::value, "");
static_assert( std::is_nothrow_move_assignable<Value>::value, ""); static_assert(std::is_assignable<Value,Value>::value, "");
#ifndef _MSC_VER
static_assert( std::is_destructible<Value>::value, ""); static_assert(!std::is_copy_assignable<Value>::value, "");
static_assert( std::is_nothrow_destructible<Value>::value, ""); #endif
static_assert(std::is_move_assignable<Value>::value, "");
#ifndef _MSC_VER
static_assert(std::is_nothrow_assignable<Value, Value>::value, "");
#endif
static_assert(!std::is_nothrow_copy_assignable<Value>::value, "");
#ifndef _MSC_VER
static_assert(std::is_nothrow_move_assignable<Value>::value, "");
#endif
static_assert(std::is_destructible<Value>::value, "");
#ifndef _MSC_VER
static_assert(std::is_nothrow_destructible<Value>::value, "");
#endif
} }
TEST(Value, MoveConstructor) { TEST(Value, MoveConstructor) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment