Modify

Ticket #7827 (closed Bugs: fixed)

Opened 16 months ago

Last modified 10 months ago

[range] cant compile r | indexed to range algorithm

Reported by: Akira Takahashi <faithandbrave@…> Owned by: neilgroves
Milestone: To Be Determined Component: range
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

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.

Attachments

indexed.hpp.patch Download (620 bytes) - added by Akira Takahashi <faithandbrave@…> 16 months ago.
indexed.cpp.patch Download (1.5 KB) - added by Akira Takahashi <faithandbrave@…> 16 months ago.
add test

Change History

Changed 16 months ago by Akira Takahashi <faithandbrave@…>

Changed 16 months ago by Akira Takahashi <faithandbrave@…>

add test

comment:1 Changed 11 months ago by nathanridge

(In [84617]) [range] Make iterator of 'indexed' adaptor default-constructible (refs #7827).

comment:2 Changed 11 months ago by nathanridge

Thanks for the report and patch! Fixed in trunk.

comment:3 Changed 11 months ago by Akira Takahashi

Thanks for fix!

comment:4 Changed 10 months ago by nathanridge

  • Status changed from new to closed
  • Resolution set to fixed

(In [84823]) [range] Merge Boost.Range bug fixes to release branch (fixes #6944; fixes #7407; fixes #7408; fixes #7731; fixes #7827; fixes #8338; fixes #8453).

comment:5 Changed 10 months ago by nathanridge

Fixed for 1.54.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.