Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
c843a265
Commit
c843a265
authored
Apr 04, 2016
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to fix all /W4 warnings in VC2015
parent
2418d7cd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
35 deletions
+41
-35
CMakeLists.txt
CMakeLists.txt
+1
-0
CMakeLists.txt
example/CMakeLists.txt
+0
-2
document.h
include/rapidjson/document.h
+2
-3
schema.h
include/rapidjson/schema.h
+2
-1
CMakeLists.txt
test/unittest/CMakeLists.txt
+0
-2
documenttest.cpp
test/unittest/documenttest.cpp
+20
-20
istreamwrappertest.cpp
test/unittest/istreamwrappertest.cpp
+10
-1
readertest.cpp
test/unittest/readertest.cpp
+1
-1
valuetest.cpp
test/unittest/valuetest.cpp
+5
-5
No files found.
CMakeLists.txt
View file @
c843a265
...
@@ -54,6 +54,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
...
@@ -54,6 +54,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif
()
endif
()
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
add_definitions
(
-D_CRT_SECURE_NO_WARNINGS=1
)
add_definitions
(
-D_CRT_SECURE_NO_WARNINGS=1
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/EHsc"
)
endif
()
endif
()
#add extra search paths for libraries and includes
#add extra search paths for libraries and includes
...
...
example/CMakeLists.txt
View file @
c843a265
...
@@ -23,8 +23,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
...
@@ -23,8 +23,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-pthread -Werror -Wall -Wextra -Weffc++ -Wswitch-default"
)
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
elseif
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough -Weverything"
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
add_definitions
(
-D_CRT_SECURE_NO_WARNINGS=1
)
endif
()
endif
()
foreach
(
example
${
EXAMPLES
}
)
foreach
(
example
${
EXAMPLES
}
)
...
...
include/rapidjson/document.h
View file @
c843a265
...
@@ -1794,7 +1794,7 @@ private:
...
@@ -1794,7 +1794,7 @@ private:
template
<
typename
,
typename
>
friend
class
GenericValue
;
template
<
typename
,
typename
>
friend
class
GenericValue
;
template
<
typename
,
typename
,
typename
>
friend
class
GenericDocument
;
template
<
typename
,
typename
,
typename
>
friend
class
GenericDocument
;
enum
{
static
const
uint16_t
kBoolFlag
=
0x0008
,
kBoolFlag
=
0x0008
,
kNumberFlag
=
0x0010
,
kNumberFlag
=
0x0010
,
kIntFlag
=
0x0020
,
kIntFlag
=
0x0020
,
...
@@ -1822,8 +1822,7 @@ private:
...
@@ -1822,8 +1822,7 @@ private:
kObjectFlag
=
kObjectType
,
kObjectFlag
=
kObjectType
,
kArrayFlag
=
kArrayType
,
kArrayFlag
=
kArrayType
,
kTypeMask
=
0x07
kTypeMask
=
0x07
;
};
static
const
SizeType
kDefaultArrayCapacity
=
16
;
static
const
SizeType
kDefaultArrayCapacity
=
16
;
static
const
SizeType
kDefaultObjectCapacity
=
16
;
static
const
SizeType
kDefaultObjectCapacity
=
16
;
...
...
include/rapidjson/schema.h
View file @
c843a265
...
@@ -1963,7 +1963,8 @@ public:
...
@@ -1963,7 +1963,8 @@ public:
GenericSchemaValidator
<
SchemaDocumentType
,
Handler
>
validator
(
sd_
,
handler
);
GenericSchemaValidator
<
SchemaDocumentType
,
Handler
>
validator
(
sd_
,
handler
);
parseResult_
=
reader
.
template
Parse
<
parseFlags
>
(
is_
,
validator
);
parseResult_
=
reader
.
template
Parse
<
parseFlags
>
(
is_
,
validator
);
if
((
isValid_
=
validator
.
IsValid
()))
{
isValid_
=
validator
.
IsValid
();
if
(
isValid_
)
{
invalidSchemaPointer_
=
PointerType
();
invalidSchemaPointer_
=
PointerType
();
invalidSchemaKeyword_
=
0
;
invalidSchemaKeyword_
=
0
;
invalidDocumentPointer_
=
PointerType
();
invalidDocumentPointer_
=
PointerType
();
...
...
test/unittest/CMakeLists.txt
View file @
c843a265
...
@@ -57,8 +57,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
...
@@ -57,8 +57,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
else
()
else
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/WX"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/WX"
)
endif
()
endif
()
add_definitions
(
-D_CRT_SECURE_NO_WARNINGS=1
)
endif
()
endif
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DRAPIDJSON_HAS_STDSTRING=1"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DRAPIDJSON_HAS_STDSTRING=1"
)
...
...
test/unittest/documenttest.cpp
View file @
c843a265
...
@@ -447,10 +447,10 @@ TYPED_TEST_CASE(DocumentMove, MoveAllocatorTypes);
...
@@ -447,10 +447,10 @@ TYPED_TEST_CASE(DocumentMove, MoveAllocatorTypes);
TYPED_TEST
(
DocumentMove
,
MoveConstructor
)
{
TYPED_TEST
(
DocumentMove
,
MoveConstructor
)
{
typedef
TypeParam
Allocator
;
typedef
TypeParam
Allocator
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
ocument
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
;
Allocator
allocator
;
Allocator
allocator
;
D
ocument
a
(
&
allocator
);
D
a
(
&
allocator
);
a
.
Parse
(
"[
\"
one
\"
,
\"
two
\"
,
\"
three
\"
]"
);
a
.
Parse
(
"[
\"
one
\"
,
\"
two
\"
,
\"
three
\"
]"
);
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_TRUE
(
a
.
IsArray
());
EXPECT_TRUE
(
a
.
IsArray
());
...
@@ -458,7 +458,7 @@ TYPED_TEST(DocumentMove, MoveConstructor) {
...
@@ -458,7 +458,7 @@ TYPED_TEST(DocumentMove, MoveConstructor) {
EXPECT_EQ
(
&
a
.
GetAllocator
(),
&
allocator
);
EXPECT_EQ
(
&
a
.
GetAllocator
(),
&
allocator
);
// Document b(a); // does not compile (!is_copy_constructible)
// Document b(a); // does not compile (!is_copy_constructible)
D
ocument
b
(
std
::
move
(
a
));
D
b
(
std
::
move
(
a
));
EXPECT_TRUE
(
a
.
IsNull
());
EXPECT_TRUE
(
a
.
IsNull
());
EXPECT_TRUE
(
b
.
IsArray
());
EXPECT_TRUE
(
b
.
IsArray
());
EXPECT_EQ
(
3u
,
b
.
Size
());
EXPECT_EQ
(
3u
,
b
.
Size
());
...
@@ -471,7 +471,7 @@ TYPED_TEST(DocumentMove, MoveConstructor) {
...
@@ -471,7 +471,7 @@ TYPED_TEST(DocumentMove, MoveConstructor) {
EXPECT_EQ
(
2u
,
b
.
MemberCount
());
EXPECT_EQ
(
2u
,
b
.
MemberCount
());
// Document c = a; // does not compile (!is_copy_constructible)
// Document c = a; // does not compile (!is_copy_constructible)
D
ocument
c
=
std
::
move
(
b
);
D
c
=
std
::
move
(
b
);
EXPECT_TRUE
(
b
.
IsNull
());
EXPECT_TRUE
(
b
.
IsNull
());
EXPECT_TRUE
(
c
.
IsObject
());
EXPECT_TRUE
(
c
.
IsObject
());
EXPECT_EQ
(
2u
,
c
.
MemberCount
());
EXPECT_EQ
(
2u
,
c
.
MemberCount
());
...
@@ -481,17 +481,17 @@ TYPED_TEST(DocumentMove, MoveConstructor) {
...
@@ -481,17 +481,17 @@ TYPED_TEST(DocumentMove, MoveConstructor) {
TYPED_TEST
(
DocumentMove
,
MoveConstructorParseError
)
{
TYPED_TEST
(
DocumentMove
,
MoveConstructorParseError
)
{
typedef
TypeParam
Allocator
;
typedef
TypeParam
Allocator
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
ocument
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
;
ParseResult
noError
;
ParseResult
noError
;
D
ocument
a
;
D
a
;
a
.
Parse
(
"{ 4 = 4]"
);
a
.
Parse
(
"{ 4 = 4]"
);
ParseResult
error
(
a
.
GetParseError
(),
a
.
GetErrorOffset
());
ParseResult
error
(
a
.
GetParseError
(),
a
.
GetErrorOffset
());
EXPECT_TRUE
(
a
.
HasParseError
());
EXPECT_TRUE
(
a
.
HasParseError
());
EXPECT_NE
(
error
.
Code
(),
noError
.
Code
());
EXPECT_NE
(
error
.
Code
(),
noError
.
Code
());
EXPECT_NE
(
error
.
Offset
(),
noError
.
Offset
());
EXPECT_NE
(
error
.
Offset
(),
noError
.
Offset
());
D
ocument
b
(
std
::
move
(
a
));
D
b
(
std
::
move
(
a
));
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_TRUE
(
b
.
HasParseError
());
EXPECT_TRUE
(
b
.
HasParseError
());
EXPECT_EQ
(
a
.
GetParseError
(),
noError
.
Code
());
EXPECT_EQ
(
a
.
GetParseError
(),
noError
.
Code
());
...
@@ -499,7 +499,7 @@ TYPED_TEST(DocumentMove, MoveConstructorParseError) {
...
@@ -499,7 +499,7 @@ TYPED_TEST(DocumentMove, MoveConstructorParseError) {
EXPECT_EQ
(
a
.
GetErrorOffset
(),
noError
.
Offset
());
EXPECT_EQ
(
a
.
GetErrorOffset
(),
noError
.
Offset
());
EXPECT_EQ
(
b
.
GetErrorOffset
(),
error
.
Offset
());
EXPECT_EQ
(
b
.
GetErrorOffset
(),
error
.
Offset
());
D
ocument
c
(
std
::
move
(
b
));
D
c
(
std
::
move
(
b
));
EXPECT_FALSE
(
b
.
HasParseError
());
EXPECT_FALSE
(
b
.
HasParseError
());
EXPECT_TRUE
(
c
.
HasParseError
());
EXPECT_TRUE
(
c
.
HasParseError
());
EXPECT_EQ
(
b
.
GetParseError
(),
noError
.
Code
());
EXPECT_EQ
(
b
.
GetParseError
(),
noError
.
Code
());
...
@@ -540,10 +540,10 @@ TYPED_TEST(DocumentMove, MoveConstructorStack) {
...
@@ -540,10 +540,10 @@ TYPED_TEST(DocumentMove, MoveConstructorStack) {
TYPED_TEST
(
DocumentMove
,
MoveAssignment
)
{
TYPED_TEST
(
DocumentMove
,
MoveAssignment
)
{
typedef
TypeParam
Allocator
;
typedef
TypeParam
Allocator
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
ocument
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
;
Allocator
allocator
;
Allocator
allocator
;
D
ocument
a
(
&
allocator
);
D
a
(
&
allocator
);
a
.
Parse
(
"[
\"
one
\"
,
\"
two
\"
,
\"
three
\"
]"
);
a
.
Parse
(
"[
\"
one
\"
,
\"
two
\"
,
\"
three
\"
]"
);
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_TRUE
(
a
.
IsArray
());
EXPECT_TRUE
(
a
.
IsArray
());
...
@@ -551,7 +551,7 @@ TYPED_TEST(DocumentMove, MoveAssignment) {
...
@@ -551,7 +551,7 @@ TYPED_TEST(DocumentMove, MoveAssignment) {
EXPECT_EQ
(
&
a
.
GetAllocator
(),
&
allocator
);
EXPECT_EQ
(
&
a
.
GetAllocator
(),
&
allocator
);
// Document b; b = a; // does not compile (!is_copy_assignable)
// Document b; b = a; // does not compile (!is_copy_assignable)
D
ocument
b
;
D
b
;
b
=
std
::
move
(
a
);
b
=
std
::
move
(
a
);
EXPECT_TRUE
(
a
.
IsNull
());
EXPECT_TRUE
(
a
.
IsNull
());
EXPECT_TRUE
(
b
.
IsArray
());
EXPECT_TRUE
(
b
.
IsArray
());
...
@@ -565,7 +565,7 @@ TYPED_TEST(DocumentMove, MoveAssignment) {
...
@@ -565,7 +565,7 @@ TYPED_TEST(DocumentMove, MoveAssignment) {
EXPECT_EQ
(
2u
,
b
.
MemberCount
());
EXPECT_EQ
(
2u
,
b
.
MemberCount
());
// Document c; c = a; // does not compile (see static_assert)
// Document c; c = a; // does not compile (see static_assert)
D
ocument
c
;
D
c
;
c
=
std
::
move
(
b
);
c
=
std
::
move
(
b
);
EXPECT_TRUE
(
b
.
IsNull
());
EXPECT_TRUE
(
b
.
IsNull
());
EXPECT_TRUE
(
c
.
IsObject
());
EXPECT_TRUE
(
c
.
IsObject
());
...
@@ -576,17 +576,17 @@ TYPED_TEST(DocumentMove, MoveAssignment) {
...
@@ -576,17 +576,17 @@ TYPED_TEST(DocumentMove, MoveAssignment) {
TYPED_TEST
(
DocumentMove
,
MoveAssignmentParseError
)
{
TYPED_TEST
(
DocumentMove
,
MoveAssignmentParseError
)
{
typedef
TypeParam
Allocator
;
typedef
TypeParam
Allocator
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
ocument
;
typedef
GenericDocument
<
UTF8
<>
,
Allocator
>
D
;
ParseResult
noError
;
ParseResult
noError
;
D
ocument
a
;
D
a
;
a
.
Parse
(
"{ 4 = 4]"
);
a
.
Parse
(
"{ 4 = 4]"
);
ParseResult
error
(
a
.
GetParseError
(),
a
.
GetErrorOffset
());
ParseResult
error
(
a
.
GetParseError
(),
a
.
GetErrorOffset
());
EXPECT_TRUE
(
a
.
HasParseError
());
EXPECT_TRUE
(
a
.
HasParseError
());
EXPECT_NE
(
error
.
Code
(),
noError
.
Code
());
EXPECT_NE
(
error
.
Code
(),
noError
.
Code
());
EXPECT_NE
(
error
.
Offset
(),
noError
.
Offset
());
EXPECT_NE
(
error
.
Offset
(),
noError
.
Offset
());
D
ocument
b
;
D
b
;
b
=
std
::
move
(
a
);
b
=
std
::
move
(
a
);
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_FALSE
(
a
.
HasParseError
());
EXPECT_TRUE
(
b
.
HasParseError
());
EXPECT_TRUE
(
b
.
HasParseError
());
...
@@ -595,7 +595,7 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) {
...
@@ -595,7 +595,7 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) {
EXPECT_EQ
(
a
.
GetErrorOffset
(),
noError
.
Offset
());
EXPECT_EQ
(
a
.
GetErrorOffset
(),
noError
.
Offset
());
EXPECT_EQ
(
b
.
GetErrorOffset
(),
error
.
Offset
());
EXPECT_EQ
(
b
.
GetErrorOffset
(),
error
.
Offset
());
D
ocument
c
;
D
c
;
c
=
std
::
move
(
b
);
c
=
std
::
move
(
b
);
EXPECT_FALSE
(
b
.
HasParseError
());
EXPECT_FALSE
(
b
.
HasParseError
());
EXPECT_TRUE
(
c
.
HasParseError
());
EXPECT_TRUE
(
c
.
HasParseError
());
...
@@ -612,9 +612,9 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) {
...
@@ -612,9 +612,9 @@ TYPED_TEST(DocumentMove, MoveAssignmentParseError) {
TYPED_TEST(DocumentMove, MoveAssignmentStack) {
TYPED_TEST(DocumentMove, MoveAssignmentStack) {
typedef TypeParam Allocator;
typedef TypeParam Allocator;
typedef UTF8<> Encoding;
typedef UTF8<> Encoding;
typedef GenericDocument<Encoding, Allocator> D
ocument
;
typedef GenericDocument<Encoding, Allocator> D;
D
ocument
a;
D a;
size_t defaultCapacity = a.GetStackCapacity();
size_t defaultCapacity = a.GetStackCapacity();
// Trick Document into getting GetStackCapacity() to return non-zero
// Trick Document into getting GetStackCapacity() to return non-zero
...
@@ -625,12 +625,12 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) {
...
@@ -625,12 +625,12 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) {
size_t capacity = a.GetStackCapacity();
size_t capacity = a.GetStackCapacity();
EXPECT_GT(capacity, 0u);
EXPECT_GT(capacity, 0u);
D
ocument
b;
D b;
b = std::move(a);
b = std::move(a);
EXPECT_EQ(a.GetStackCapacity(), defaultCapacity);
EXPECT_EQ(a.GetStackCapacity(), defaultCapacity);
EXPECT_EQ(b.GetStackCapacity(), capacity);
EXPECT_EQ(b.GetStackCapacity(), capacity);
D
ocument
c;
D c;
c = std::move(b);
c = std::move(b);
EXPECT_EQ(b.GetStackCapacity(), defaultCapacity);
EXPECT_EQ(b.GetStackCapacity(), defaultCapacity);
EXPECT_EQ(c.GetStackCapacity(), capacity);
EXPECT_EQ(c.GetStackCapacity(), capacity);
...
...
test/unittest/istreamwrappertest.cpp
View file @
c843a265
...
@@ -20,6 +20,11 @@
...
@@ -20,6 +20,11 @@
#include <sstream>
#include <sstream>
#include <fstream>
#include <fstream>
#ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF
(
4702
)
// unreachable code
#endif
using
namespace
rapidjson
;
using
namespace
rapidjson
;
using
namespace
std
;
using
namespace
std
;
...
@@ -168,4 +173,8 @@ TEST(IStreamWrapper, wfstream) {
...
@@ -168,4 +173,8 @@ TEST(IStreamWrapper, wfstream) {
EXPECT_EQ(5, d.MemberCount());
EXPECT_EQ(5, d.MemberCount());
}
}
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
#endif
#ifdef _MSC_VER
RAPIDJSON_DIAG_POP
#endif
test/unittest/readertest.cpp
View file @
c843a265
...
@@ -720,7 +720,7 @@ TEST(Reader, ParseString_Error) {
...
@@ -720,7 +720,7 @@ TEST(Reader, ParseString_Error) {
TEST_STRINGENCODING_ERROR
(
UTF32
<>
,
UTF8
<>
,
unsigned
,
ARRAY
(
'['
,
'\"'
,
0x110000
,
'\"'
,
']'
,
'\0'
));
TEST_STRINGENCODING_ERROR
(
UTF32
<>
,
UTF8
<>
,
unsigned
,
ARRAY
(
'['
,
'\"'
,
0x110000
,
'\"'
,
']'
,
'\0'
));
// Malform ASCII sequence
// Malform ASCII sequence
TEST_STRINGENCODING_ERROR
(
ASCII
<>
,
UTF8
<>
,
char
,
ARRAY
(
'['
,
'\"'
,
char
(
0x80
),
'\"'
,
']'
,
'\0'
));
TEST_STRINGENCODING_ERROR
(
ASCII
<>
,
UTF8
<>
,
char
,
ARRAY
(
'['
,
'\"'
,
char
(
0x80
u
),
'\"'
,
']'
,
'\0'
));
#undef ARRAY
#undef ARRAY
#undef TEST_STRINGARRAY_ERROR
#undef TEST_STRINGARRAY_ERROR
...
...
test/unittest/valuetest.cpp
View file @
c843a265
...
@@ -94,23 +94,23 @@ TEST(Value, Traits) {
...
@@ -94,23 +94,23 @@ TEST(Value, Traits) {
#endif
#endif
TEST
(
Value
,
MoveConstructor
)
{
TEST
(
Value
,
MoveConstructor
)
{
typedef
GenericValue
<
UTF8
<>
,
CrtAllocator
>
V
alue
;
typedef
GenericValue
<
UTF8
<>
,
CrtAllocator
>
V
;
V
alue
::
AllocatorType
allocator
;
V
::
AllocatorType
allocator
;
V
alue
x
((
Value
(
kArrayType
)));
V
x
((
V
(
kArrayType
)));
x
.
Reserve
(
4u
,
allocator
);
x
.
Reserve
(
4u
,
allocator
);
x
.
PushBack
(
1
,
allocator
).
PushBack
(
2
,
allocator
).
PushBack
(
3
,
allocator
).
PushBack
(
4
,
allocator
);
x
.
PushBack
(
1
,
allocator
).
PushBack
(
2
,
allocator
).
PushBack
(
3
,
allocator
).
PushBack
(
4
,
allocator
);
EXPECT_TRUE
(
x
.
IsArray
());
EXPECT_TRUE
(
x
.
IsArray
());
EXPECT_EQ
(
4u
,
x
.
Size
());
EXPECT_EQ
(
4u
,
x
.
Size
());
// Value y(x); // does not compile (!is_copy_constructible)
// Value y(x); // does not compile (!is_copy_constructible)
V
alue
y
(
std
::
move
(
x
));
V
y
(
std
::
move
(
x
));
EXPECT_TRUE
(
x
.
IsNull
());
EXPECT_TRUE
(
x
.
IsNull
());
EXPECT_TRUE
(
y
.
IsArray
());
EXPECT_TRUE
(
y
.
IsArray
());
EXPECT_EQ
(
4u
,
y
.
Size
());
EXPECT_EQ
(
4u
,
y
.
Size
());
// Value z = y; // does not compile (!is_copy_assignable)
// Value z = y; // does not compile (!is_copy_assignable)
V
alue
z
=
std
::
move
(
y
);
V
z
=
std
::
move
(
y
);
EXPECT_TRUE
(
y
.
IsNull
());
EXPECT_TRUE
(
y
.
IsNull
());
EXPECT_TRUE
(
z
.
IsArray
());
EXPECT_TRUE
(
z
.
IsArray
());
EXPECT_EQ
(
4u
,
z
.
Size
());
EXPECT_EQ
(
4u
,
z
.
Size
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment