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
2f2c7594
Unverified
Commit
2f2c7594
authored
Mar 25, 2021
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
💚
fix build
parent
360f21e1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
at.md
doc/mkdocs/docs/api/basic_json/at.md
+2
-1
operator[].md
doc/mkdocs/docs/api/basic_json/operator[].md
+2
-1
json.hpp
include/nlohmann/json.hpp
+11
-6
json.hpp
single_include/nlohmann/json.hpp
+11
-6
No files found.
doc/mkdocs/docs/api/basic_json/at.md
View file @
2f2c7594
...
...
@@ -23,7 +23,8 @@ const_reference at(const json_pointer& ptr) const;
## Template parameters
`KeyT`
: A type convertible to an object key. This can also be a string literal or a string view (C++17).
: A type for an object key other than
`basic_json::json_pointer`
. This can also be a string literal or a string view
(C++17).
## Parameters
...
...
doc/mkdocs/docs/api/basic_json/operator[].md
View file @
2f2c7594
...
...
@@ -27,7 +27,8 @@ const_reference operator[](const json_pointer& ptr) const;
## Template parameters
`KeyT`
: A type convertible to an object key. This can also be a string literal or a string view (C++17).
: A type for an object key other than
`basic_json::json_pointer`
. This can also be a string literal or a string view
(C++17).
`T`
: string literal convertible to
`object_t::key_type`
...
...
include/nlohmann/json.hpp
View file @
2f2c7594
...
...
@@ -3494,10 +3494,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
can be thrown.,at__object_t_key_type}
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
reference
at
(
KeyT
&&
key
)
{
// at only works for objects
...
...
@@ -3546,10 +3547,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
at__object_t_key_type_const}
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
const_reference
at
(
KeyT
&&
key
)
const
{
// at only works for objects
...
...
@@ -3684,10 +3686,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
reference
operator
[](
KeyT
&&
key
)
{
// implicitly convert null value to an empty object
...
...
@@ -3739,17 +3742,19 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
const_reference
operator
[](
KeyT
&&
key
)
const
{
// const operator[] only works for objects
if
(
JSON_HEDLEY_LIKELY
(
is_object
()))
{
JSON_ASSERT
(
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
))
!=
m_value
.
object
->
end
());
return
m_value
.
object
->
find
(
key
)
->
second
;
auto
it
=
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
));
JSON_ASSERT
(
it
!=
m_value
.
object
->
end
());
return
it
->
second
;
}
JSON_THROW
(
type_error
::
create
(
305
,
"cannot use operator[] with a string argument with "
+
std
::
string
(
type_name
()),
*
this
));
...
...
single_include/nlohmann/json.hpp
View file @
2f2c7594
...
...
@@ -20307,10 +20307,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
can be thrown.,at__object_t_key_type}
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
reference
at
(
KeyT
&&
key
)
{
// at only works for objects
...
...
@@ -20359,10 +20360,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
at__object_t_key_type_const}
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
const_reference
at
(
KeyT
&&
key
)
const
{
// at only works for objects
...
...
@@ -20497,10 +20499,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
reference
operator
[](
KeyT
&&
key
)
{
// implicitly convert null value to an empty object
...
...
@@ -20552,17 +20555,19 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@since version 1.0.0
*/
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
||
#endif
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
,
int
>::
type
=
0
>
std
::
is_convertible
<
KeyT
,
typename
object_t
::
key_type
>::
value
)
,
int
>::
type
=
0
>
const_reference
operator
[](
KeyT
&&
key
)
const
{
// const operator[] only works for objects
if
(
JSON_HEDLEY_LIKELY
(
is_object
()))
{
JSON_ASSERT
(
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
))
!=
m_value
.
object
->
end
());
return
m_value
.
object
->
find
(
key
)
->
second
;
auto
it
=
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
));
JSON_ASSERT
(
it
!=
m_value
.
object
->
end
());
return
it
->
second
;
}
JSON_THROW
(
type_error
::
create
(
305
,
"cannot use operator[] with a string argument with "
+
std
::
string
(
type_name
()),
*
this
));
...
...
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