diff --git a/include/nana/c++defines.hpp b/include/nana/c++defines.hpp index 98c23dc4..fa43923d 100644 --- a/include/nana/c++defines.hpp +++ b/include/nana/c++defines.hpp @@ -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 diff --git a/include/nana/gui/widgets/detail/widget_iterator.hpp b/include/nana/gui/widgets/detail/widget_iterator.hpp new file mode 100644 index 00000000..c78e5d4d --- /dev/null +++ b/include/nana/gui/widgets/detail/widget_iterator.hpp @@ -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 //provides std::ptrdiff_t + + +namespace nana { + namespace widgets { + namespace detail + { + template + class widget_iterator + { + using iterator_category = Category; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = T * ; + using reference = T & ; + }; + } + } +} + +#endif diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index 71280b7e..0137ff51 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -23,6 +23,7 @@ #include "widget.hpp" #include "detail/inline_widget.hpp" +#include "detail/widget_iterator.hpp" #include #include #include @@ -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 + //: public std::iterator //deprecated + : public ::nana::widgets::detail::widget_iterator { 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 //deprecated + : public ::nana::widgets::detail::widget_iterator { public: using inline_notifier_interface = drawerbase::listbox::inline_notifier_interface;