Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
d01a6a46
Unverified
Commit
d01a6a46
authored
Mar 26, 2021
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚧
add overload for erase(std::string_view)
parent
16fb0cbb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
json.hpp
include/nlohmann/json.hpp
+12
-5
json.hpp
single_include/nlohmann/json.hpp
+12
-5
unit-element_access2.cpp
test/src/unit-element_access2.cpp
+0
-0
No files found.
include/nlohmann/json.hpp
View file @
d01a6a46
...
...
@@ -3496,7 +3496,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
reference
at
(
KeyT
&&
key
)
...
...
@@ -3549,7 +3549,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
const_reference
at
(
KeyT
&&
key
)
const
...
...
@@ -3688,7 +3688,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
reference
operator
[](
KeyT
&&
key
)
...
...
@@ -3744,7 +3744,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
const_reference
operator
[](
KeyT
&&
key
)
const
...
...
@@ -4363,7 +4363,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
*/
template
<
class
KeyT
,
typename
std
::
enable_if
<
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
&&
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
size_type
erase
(
KeyT
&&
key
)
...
...
@@ -4377,6 +4377,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
JSON_THROW
(
type_error
::
create
(
307
,
"cannot use erase() with "
+
std
::
string
(
type_name
()),
*
this
));
}
#if defined(JSON_HAS_CPP_17)
size_type
erase
(
std
::
string_view
key
)
{
return
erase
(
typename
object_t
::
key_type
(
key
.
data
(),
key
.
size
()));
}
#endif
/*!
@brief remove element from a JSON array given an index
...
...
single_include/nlohmann/json.hpp
View file @
d01a6a46
...
...
@@ -20385,7 +20385,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
reference
at
(
KeyT
&&
key
)
...
...
@@ -20438,7 +20438,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
const_reference
at
(
KeyT
&&
key
)
const
...
...
@@ -20577,7 +20577,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
reference
operator
[](
KeyT
&&
key
)
...
...
@@ -20633,7 +20633,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
template
<
class
KeyT
,
typename
std
::
enable_if
<
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
json_pointer
>::
value
&&
(
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
),
int
>::
type
=
0
>
const_reference
operator
[](
KeyT
&&
key
)
const
...
...
@@ -21252,7 +21252,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
*/
template
<
class
KeyT
,
typename
std
::
enable_if
<
#if defined(JSON_HAS_CPP_17)
std
::
is_same
<
KeyT
,
std
::
string_view
>::
value
||
!
std
::
is_same
<
typename
std
::
decay
<
KeyT
>::
type
,
std
::
string_view
>::
value
&&
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
size_type
erase
(
KeyT
&&
key
)
...
...
@@ -21266,6 +21266,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
JSON_THROW
(
type_error
::
create
(
307
,
"cannot use erase() with "
+
std
::
string
(
type_name
()),
*
this
));
}
#if defined(JSON_HAS_CPP_17)
size_type
erase
(
std
::
string_view
key
)
{
return
erase
(
typename
object_t
::
key_type
(
key
.
data
(),
key
.
size
()));
}
#endif
/*!
@brief remove element from a JSON array given an index
...
...
test/src/unit-element_access2.cpp
View file @
d01a6a46
This diff is collapsed.
Click to expand it.
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