[Boost-bugs] [Boost C++ Libraries] #7827: [range] cant compile r | indexed to range algorithm

Subject: [Boost-bugs] [Boost C++ Libraries] #7827: [range] cant compile r | indexed to range algorithm
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-12-25 03:07:12


#7827: [range] cant compile r | indexed to range algorithm
-------------------------------------------------------+--------------------
 Reporter: Akira Takahashi <faithandbrave@…> | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 follow code is compile error:
 {{{
 #include <iostream>
 #include <vector>
 #include <boost/range/adaptor/indexed.hpp>
 #include <boost/range/algorithm/min_element.hpp>

 int main()
 {
     std::vector<int> v = {3, 1, 4};
     auto m = boost::min_element(v | boost::adaptors::indexed(0));
     auto i = m.index();
     std::cout << i << std::endl;
     std::cout << *m << std::endl;
 }
 }}}
 {{{
 In file included from D:\GitHub\Boost\boost-
 svn/boost/range/concepts.hpp:19:0,
                  from D:\GitHub\Boost\boost-
 svn/boost/range/algorithm/equal.hpp:14,
                  from D:\GitHub\Boost\boost-
 svn/boost/range/iterator_range_core.hpp:29,
                  from D:\GitHub\Boost\boost-
 svn/boost/range/iterator_range.hpp:13,
                  from D:\GitHub\Boost\boost-
 svn/boost/range/adaptor/indexed.hpp:21,
                  from C:\language\cpp\main.cpp:3:
 D:\GitHub\Boost\boost-svn/boost/concept_check.hpp: In instantiation of
 'boost::DefaultConstructible<TT>::~DefaultConstructible() [with TT =
 boost::range_detail::indexed_iterator<__gnu_cxx::__normal_iterator<int*,
 std::vector<int> > >]':
 D:\GitHub\Boost\boost-svn/boost/concept/usage.hpp:22:29: required from
 'boost::concepts::usage_requirements<Model>::~usage_requirements() [with
 Model =
 boost::DefaultConstructible<boost::range_detail::indexed_iterator<__gnu_cxx::__normal_iterator<int*,
 std::vector<int> > > >]'
 D:\GitHub\Boost\boost-svn/boost/concept/detail/general.hpp:38:28:
 required from 'static void
 boost::concepts::requirement<boost::concepts::failed************
 Model::************>::failed() [with Model =
 boost::concepts::usage_requirements<boost::DefaultConstructible<boost::range_detail::indexed_iterator<__gnu_cxx::__normal_iterator<int*,
 std::vector<int> > > > >]'
 ...
 }}}

 Because `indexed_iterator` hasn't default constructor.
 I attach patch.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7827>
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:11 UTC