deprecate std::iterator because of C++17

This commit is contained in:
Jinhao 2017-12-20 13:51:32 +08:00
parent c66895ead6
commit 4917b18c70
3 changed files with 42 additions and 2 deletions

View File

@ -203,6 +203,7 @@
#if (defined(_MSC_VER) && (_MSC_VER >= 1912) && defined(_MSVC_LANG) && _MSVC_LANG>= 201703)
# define _nana_cxx_constexpr_if
# define _nana_cxx_folding_expression
# define _nana_cxx_nested_namespace_definition
#endif

View File

@ -0,0 +1,36 @@
/*
* A Widget Iterator Template
* Copyright(C) 2017 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/widgets/detail/widget_iterator.hpp
* @description: widget_iterator is the base class provided to simplify definitions of the required types for widget iterators.
* It is provided because of deprecation of std::iterator in C++17
*/
#ifndef NANA_GUI_WIDGET_ITERATOR_INCLUDED
#define NANA_GUI_WIDGET_ITERATOR_INCLUDED
#include <cstddef> //provides std::ptrdiff_t
namespace nana {
namespace widgets {
namespace detail
{
template<typename Category, typename T>
class widget_iterator
{
using iterator_category = Category;
using value_type = T;
using difference_type = std::ptrdiff_t;
using pointer = T * ;
using reference = T & ;
};
}
}
}
#endif

View File

@ -23,6 +23,7 @@
#include "widget.hpp"
#include "detail/inline_widget.hpp"
#include "detail/widget_iterator.hpp"
#include <nana/pat/abstract_factory.hpp>
#include <nana/concepts.hpp>
#include <nana/key_type.hpp>
@ -802,7 +803,8 @@ namespace nana
/// operate with absolute positions and contain only the position but montain pointers to parts of the real items
/// item_proxy self, it references and iterators are not invalidated by sort()
class item_proxy
: public std::iterator<std::input_iterator_tag, item_proxy>
//: public std::iterator<std::input_iterator_tag, item_proxy> //deprecated
: public ::nana::widgets::detail::widget_iterator<std::input_iterator_tag, item_proxy>
{
public:
item_proxy(essence*, const index_pair& = index_pair{npos, npos});
@ -976,7 +978,8 @@ namespace nana
};
class cat_proxy
: public std::iterator < std::input_iterator_tag, cat_proxy >
//: public std::iterator<std::input_iterator_tag, cat_proxy> //deprecated
: public ::nana::widgets::detail::widget_iterator<std::input_iterator_tag, cat_proxy>
{
public:
using inline_notifier_interface = drawerbase::listbox::inline_notifier_interface;