Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 39fc21a

Browse files
author
Peter E
committedJul 24, 2024
Fix warnings under C++ 17 (Issue #173)
1 parent 046083c commit 39fc21a

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed
 

‎AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ Travis Gockel <travis@gockelhut.com>
66

77
Contributions by:
88
Remy Chibois <remy.chibois@expandium.com> - Debian packaging, bugfixes
9+
Peter Ellis <peter.ellis@platypustech.co.uk> - C++ 17 warning fixes
910
sth <https://github.com/sth> - bugfixes

‎include/jsonv/encode.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <jsonv/forward.hpp>
1717
#include <jsonv/string_view.hpp>
1818

19+
#include <cstdint>
1920
#include <iosfwd>
2021

2122
namespace jsonv

‎include/jsonv/value.hpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,14 @@ class JSONV_PUBLIC value
136136

137137
/** The base type for iterating over array values. **/
138138
template <typename T, typename TArrayView>
139-
struct basic_array_iterator :
140-
public std::iterator<std::random_access_iterator_tag, T>
139+
struct basic_array_iterator
141140
{
142141
public:
142+
using iterator_category = std::random_access_iterator_tag;
143+
using value_type = T;
144+
using difference_type = std::ptrdiff_t;
145+
using pointer = T*;
146+
using reference = T&;
143147
basic_array_iterator() :
144148
_owner(0),
145149
_index(0)
@@ -289,10 +293,15 @@ class JSONV_PUBLIC value
289293
* \c std::map<std::string, jsonv::value>.
290294
**/
291295
template <typename T, typename TIterator>
292-
struct basic_object_iterator :
293-
public std::iterator<std::bidirectional_iterator_tag, T>
296+
struct basic_object_iterator
294297
{
295298
public:
299+
using iterator_category = std::bidirectional_iterator_tag;
300+
using value_type = T;
301+
using difference_type = std::ptrdiff_t;
302+
using pointer = T*;
303+
using reference = T&;
304+
296305
basic_object_iterator() :
297306
_impl()
298307
{ }

‎src/jsonv/encode.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "detail.hpp"
1616

1717
#include <cmath>
18+
#include <ostream>
1819

1920
namespace jsonv
2021
{
@@ -227,7 +228,7 @@ void ostream_pretty_encoder::write_decimal(double value)
227228
ostream_encoder::write_decimal(value);
228229
}
229230

230-
void ostream_pretty_encoder::write_integer(int64_t value)
231+
void ostream_pretty_encoder::write_integer(std::int64_t value)
231232
{
232233
write_prefix();
233234
ostream_encoder::write_integer(value);

‎src/jsonv/object.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void value::insert(std::initializer_list<std::pair<std::wstring, value>> items)
247247
{
248248
check_type(jsonv::kind::object, kind());
249249
for (auto& pair : items)
250-
insert(std::move(pair));
250+
insert(pair);
251251
}
252252

253253
value::object_insert_return_type value::insert(object_node_handle&& handle)

0 commit comments

Comments
 (0)
Please sign in to comment.