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
f05edc92
Commit
f05edc92
authored
Aug 07, 2017
by
Milo Yip
Committed by
GitHub
Aug 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1034 from bluehero/master
Allow Swap with ValueType
parents
d6305514
f9004b90
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
document.h
include/rapidjson/document.h
+4
-0
documenttest.cpp
test/unittest/documenttest.cpp
+8
-1
No files found.
include/rapidjson/document.h
View file @
f05edc92
...
...
@@ -2183,6 +2183,10 @@ public:
return
*
this
;
}
// Allow Swap with ValueType.
// Refer to Effective C++ 3rd Edition/Item 33: Avoid hiding inherited names.
using
ValueType
::
Swap
;
//! free-standing swap function helper
/*!
Helper function to enable support for common swap implementation pattern based on \c std::swap:
...
...
test/unittest/documenttest.cpp
View file @
f05edc92
...
...
@@ -300,7 +300,14 @@ TEST(Document, Swap) {
o
.
SetObject
().
AddMember
(
"a"
,
1
,
a
);
// Swap between Document and Value
// d1.Swap(o); // doesn't compile
d1
.
Swap
(
o
);
EXPECT_TRUE
(
d1
.
IsObject
());
EXPECT_TRUE
(
o
.
IsArray
());
d1
.
Swap
(
o
);
EXPECT_TRUE
(
d1
.
IsArray
());
EXPECT_TRUE
(
o
.
IsObject
());
o
.
Swap
(
d1
);
EXPECT_TRUE
(
d1
.
IsObject
());
EXPECT_TRUE
(
o
.
IsArray
());
...
...
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