cleanup after PR #189
This commit is contained in:
parent
21a44da89d
commit
600ad330c5
4 changed files with 755 additions and 351 deletions
|
@ -388,6 +388,7 @@ I deeply appreciate the help of the following people.
|
||||||
- [406345](https://github.com/406345) fixed two small warnings.
|
- [406345](https://github.com/406345) fixed two small warnings.
|
||||||
- [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function.
|
- [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function.
|
||||||
- [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines.
|
- [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines.
|
||||||
|
- [twelsby](https://github.com/twelsby) fixed the array subscript operator.
|
||||||
|
|
||||||
Thanks a lot for helping out!
|
Thanks a lot for helping out!
|
||||||
|
|
||||||
|
@ -404,7 +405,7 @@ $ make
|
||||||
$ ./json_unit "*"
|
$ ./json_unit "*"
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
All tests passed (3343239 assertions in 28 test cases)
|
All tests passed (3343318 assertions in 29 test cases)
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
|
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
|
||||||
|
|
1077
src/json.hpp
1077
src/json.hpp
File diff suppressed because it is too large
Load diff
|
@ -2671,14 +2671,14 @@ class basic_json
|
||||||
|
|
||||||
@since version 1.0.0
|
@since version 1.0.0
|
||||||
*/
|
*/
|
||||||
template<typename ValueType, typename
|
template < typename ValueType, typename
|
||||||
std::enable_if<
|
std::enable_if <
|
||||||
not std::is_pointer<ValueType>::value
|
not std::is_pointer<ValueType>::value
|
||||||
and not std::is_same<ValueType, typename string_t::value_type>::value
|
and not std::is_same<ValueType, typename string_t::value_type>::value
|
||||||
#ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015
|
#ifndef _MSC_VER // Fix for issue #167 operator<< abiguity under VS2015
|
||||||
and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
|
and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
|
||||||
#endif
|
#endif
|
||||||
, int>::type = 0>
|
, int >::type = 0 >
|
||||||
operator ValueType() const
|
operator ValueType() const
|
||||||
{
|
{
|
||||||
// delegate the call to get<>() const
|
// delegate the call to get<>() const
|
||||||
|
@ -3081,7 +3081,7 @@ class basic_json
|
||||||
@since version 1.0.0
|
@since version 1.0.0
|
||||||
*/
|
*/
|
||||||
template<typename T, std::size_t n>
|
template<typename T, std::size_t n>
|
||||||
reference operator[](T* (&key)[n])
|
reference operator[](T * (&key)[n])
|
||||||
{
|
{
|
||||||
return operator[](static_cast<const T>(key));
|
return operator[](static_cast<const T>(key));
|
||||||
}
|
}
|
||||||
|
@ -3116,7 +3116,7 @@ class basic_json
|
||||||
@since version 1.0.0
|
@since version 1.0.0
|
||||||
*/
|
*/
|
||||||
template<typename T, std::size_t n>
|
template<typename T, std::size_t n>
|
||||||
const_reference operator[](T* (&key)[n]) const
|
const_reference operator[](T * (&key)[n]) const
|
||||||
{
|
{
|
||||||
return operator[](static_cast<const T>(key));
|
return operator[](static_cast<const T>(key));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11500,12 +11500,12 @@ TEST_CASE("regression tests")
|
||||||
CHECK(s2 == "value");
|
CHECK(s2 == "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("character following a surrogate pair is skipped")
|
SECTION("issue #146 - character following a surrogate pair is skipped")
|
||||||
{
|
{
|
||||||
CHECK(json::parse("\"\\ud80c\\udc60abc\"").get<json::string_t>() == u8"\U00013060abc");
|
CHECK(json::parse("\"\\ud80c\\udc60abc\"").get<json::string_t>() == u8"\U00013060abc");
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("issue #144 - Cannot index by key of type static constexpr const char*")
|
SECTION("issue #171 - Cannot index by key of type static constexpr const char*")
|
||||||
{
|
{
|
||||||
json j;
|
json j;
|
||||||
|
|
||||||
|
@ -11521,12 +11521,12 @@ TEST_CASE("regression tests")
|
||||||
|
|
||||||
// Non-const access with key as "char *"
|
// Non-const access with key as "char *"
|
||||||
char _ptr_key[] = "Key3";
|
char _ptr_key[] = "Key3";
|
||||||
char * ptr_key = &_ptr_key[0];
|
char* ptr_key = &_ptr_key[0];
|
||||||
CHECK_NOTHROW(j[ptr_key] = 3);
|
CHECK_NOTHROW(j[ptr_key] = 3);
|
||||||
CHECK(j[ptr_key] == json(3));
|
CHECK(j[ptr_key] == json(3));
|
||||||
|
|
||||||
// Non-const access with key as "const char *"
|
// Non-const access with key as "const char *"
|
||||||
const char * const_ptr_key = "Key4";
|
const char* const_ptr_key = "Key4";
|
||||||
CHECK_NOTHROW(j[const_ptr_key] = 4);
|
CHECK_NOTHROW(j[const_ptr_key] = 4);
|
||||||
CHECK(j[const_ptr_key] == json(4));
|
CHECK(j[const_ptr_key] == json(4));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue