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
5fb06596
Commit
5fb06596
authored
Aug 07, 2017
by
bluehero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
8ba1f84f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
document.h
include/rapidjson/document.h
+1
-3
documenttest.cpp
test/unittest/documenttest.cpp
+10
-2
No files found.
include/rapidjson/document.h
View file @
5fb06596
...
...
@@ -2168,8 +2168,7 @@ public:
}
#endif
// Allow assignment from ValueType.
// Refer to Effective C++ 3rd Edition/Item 33: Avoid hiding inherited names.
// Allow assignment like a ValueType.
using
ValueType
::
operator
=
;
//! Exchange the contents of this document with those of another.
...
...
@@ -2188,7 +2187,6 @@ public:
}
// Allow Swap from ValueType.
// Refer to Effective C++ 3rd Edition/Item 33: Avoid hiding inherited names.
using
ValueType
::
Swap
;
//! free-standing swap function helper
...
...
test/unittest/documenttest.cpp
View file @
5fb06596
...
...
@@ -661,17 +661,25 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) {
// Issue 22: Memory corruption via operator= from Document
// Fixed by making unimplemented assignment operator private.
// Prohibit assignment from Document, But allow assignment from Value
// Prohibit assignment from Document.
// But allow assignment from ValueType/int/double/..., like a ValueType
TEST
(
Document
,
Assignment
)
{
// Document d1;
// Document d2;
// d1 = d2;
Value
x
(
1234
);
Document
d
;
Value
x
(
1234
);
d
=
x
;
EXPECT_TRUE
(
x
.
IsNull
());
// move semantic
EXPECT_EQ
(
1234
,
d
.
GetInt
());
d
=
1
;
EXPECT_EQ
(
1
,
d
.
GetInt
());
d
=
12.34
;
EXPECT_NEAR
(
12.34
,
d
.
GetDouble
(),
0.0
);
}
#ifdef __clang__
...
...
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