Re: [Boost-bugs] [Boost C++ Libraries] #12071: postfix_increment_proxy is not DefaultConstructible and doesn't have a nested public value_type

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12071: postfix_increment_proxy is not DefaultConstructible and doesn't have a nested public value_type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-23 14:58:22


#12071: postfix_increment_proxy is not DefaultConstructible and doesn't have a
nested public value_type
----------------------------------------------+----------------------------
  Reporter: Krzysztof CzaiÅ„ski <1czajnik@…> | Owner:
      Type: Bugs | jeffrey.hellrung
 Milestone: To Be Determined | Status: new
   Version: Boost 1.61.0 | Component: iterator
Resolution: | Severity: Problem
                                              | Keywords: range-v3
----------------------------------------------+----------------------------

Comment (by Krzysztof Czaiński <1czajnik@…>):

 Here's a simple fix, which works as long as the value type is
 DefaultConstructible:
 {{{
 --- boost/boost/iterator/iterator_facade.hpp
 +++ boost/boost/iterator/iterator_facade.hpp
 @@ -152,8 +152,9 @@
      template <class Iterator>
      class postfix_increment_proxy
      {
 + public:
          typedef typename iterator_value<Iterator>::type value_type;
 - public:
 + postfix_increment_proxy() {}
          explicit postfix_increment_proxy(Iterator const& x)
            : stored_value(*x)
          {}
 @@ -178,8 +179,9 @@
      template <class Iterator>
      class writable_postfix_increment_proxy
      {
 + public:
          typedef typename iterator_value<Iterator>::type value_type;
 - public:
 + writable_postfix_increment_proxy() {}
          explicit writable_postfix_increment_proxy(Iterator const& x)
            : stored_value(*x)
            , stored_iterator(x)
 }}}

 To work around values which aren't DefaultConstructible, it might be
 necessary to wrap the {{{stored_value}}} in {{{optional}}}, but the above
 simple fix will work for majority of cases.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12071#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC