Skip to content

Commit

Permalink
Don't use std::iterator; deprecated in C++17.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtv committed Jan 20, 2019
1 parent d132a3c commit 6ae2a02
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 33 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -15,6 +15,7 @@
- Fix in escaping of strings in arrays. Thanks smirql.
- Faster copying of results of large queries. Thanks Vsevolod Strukchinsky.
- Starting to handle encodings properly! Thanks to Joseph Durel.
- No longer using std::iterator (deprecated in C++17).
6.2.5
- Removed deprecated pqxx-config.
- Build fix on Visual C++ when not defining NOMINMAX.
Expand Down
13 changes: 6 additions & 7 deletions include/pqxx/cursor.hxx
Expand Up @@ -4,7 +4,7 @@
*
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/cursor instead.
*
* Copyright (c) 2004-2018, Jeroen T. Vermeulen.
* Copyright (c) 2004-2019, Jeroen T. Vermeulen.
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
Expand Down Expand Up @@ -385,14 +385,13 @@ private:
* stream is <em>not thread-safe</em>. Creating a new iterator, copying one, or
* destroying one affects the stream as a whole.
*/
class PQXX_LIBEXPORT icursor_iterator :
public std::iterator<std::input_iterator_tag,
result,
cursor_base::size_type,
const result *,
const result &>
class PQXX_LIBEXPORT icursor_iterator
{
public:
using iterator_category = std::input_iterator_tag;
using value_type = result;
using pointer = const result *;
using reference = const result &;
using istream_type = icursorstream;
using size_type = istream_type::size_type;
using difference_type = istream_type::difference_type;
Expand Down
13 changes: 4 additions & 9 deletions include/pqxx/result_iterator.hxx
Expand Up @@ -4,7 +4,7 @@
*
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/result instead.
*
* Copyright (c) 2001-2018, Jeroen T. Vermeulen.
* Copyright (c) 2001-2019, Jeroen T. Vermeulen.
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
Expand Down Expand Up @@ -32,16 +32,11 @@ namespace pqxx
* plain iterator type for result. However its const_iterator type can be
* used to inspect its rows without changing them.
*/
class PQXX_LIBEXPORT const_result_iterator :
public std::iterator<
std::random_access_iterator_tag,
const row,
result::difference_type,
const_result_iterator,
row>,
public row
class PQXX_LIBEXPORT const_result_iterator : public row
{
public:
using iterator_category = std::random_access_iterator_tag;
using value_type = const row;
using pointer = const row *;
using reference = row;
using size_type = result_size_type;
Expand Down
19 changes: 5 additions & 14 deletions include/pqxx/row.hxx
Expand Up @@ -4,7 +4,7 @@
*
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/result instead.
*
* Copyright (c) 2001-2018, Jeroen T. Vermeulen.
* Copyright (c) 2001-2019, Jeroen T. Vermeulen.
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
Expand Down Expand Up @@ -204,21 +204,12 @@ protected:


/// Iterator for fields in a row. Use as row::const_iterator.
class PQXX_LIBEXPORT const_row_iterator :
public std::iterator<
std::random_access_iterator_tag,
const field,
row_size_type
>,
public field
class PQXX_LIBEXPORT const_row_iterator : public field
{
using it = std::iterator<
std::random_access_iterator_tag,
const field,
row_size_type
>;
public:
using it::pointer;
using iterator_category = std::random_access_iterator_tag;
using value_type = const field;
using pointer = const field *;
using size_type = row_size_type;
using difference_type = row_difference_type;
using reference = field;
Expand Down
7 changes: 4 additions & 3 deletions include/pqxx/tablewriter.hxx
Expand Up @@ -4,7 +4,7 @@
*
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablewriter.hxx instead.
*
* Copyright (c) 2001-2018, Jeroen T. Vermeulen.
* Copyright (c) 2001-2019, Jeroen T. Vermeulen.
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
Expand Down Expand Up @@ -73,10 +73,11 @@ private:
namespace std
{
template<>
class back_insert_iterator<pqxx::tablewriter> :
public iterator<output_iterator_tag, void,void,void,void>
class back_insert_iterator<pqxx::tablewriter>
{
public:
using iterator_category = output_iterator_tag;

explicit back_insert_iterator(pqxx::tablewriter &W) noexcept :
m_writer{&W} {}

Expand Down

0 comments on commit 6ae2a02

Please sign in to comment.