Opened 12 years ago

Closed 11 years ago

#5486 closed Patches (fixed)

adjacent_filtered_range::m_pred should be removed

Reported by: iorate Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

boost::range_detail::adjacent_filtered_range<P, R, default_pass>::m_pred is not only unused, but also inhibits instantiation of the class when P is not default constructible.

rng | boost::adaptors::adjacent_filtered(std::not2(pred)); // error

I think m_pred and m_range (which is also unused) should be removed.

  • adjacent_filtered.hpp

     
    143143                         skip_iter(boost::end(r), boost::end(r), p))
    144144            {
    145145            }
    146 
    147         private:
    148             P m_pred;
    149             R* m_range;
    150146        };
    151147
    152148        template< class T >

(When P is not default constructible, the instance of skip_iterator is degraded to an input iterator, but the same goes for filter_iterator.)

In case m_pred is not removed, the reference of adjacent_filtered should be modified.

Change:

Throws: Whatever the copy constructor of bi_pred might throw.

To:

Throws: Whatever the copy constructor and default constructor of bi_pred might throw.

Change History (1)

comment:1 by Neil Groves, 11 years ago

Resolution: fixed
Status: newclosed

Thank you for the report. The offending unnecessary variables have been removed. The change has been committed to the trunk, and a suitable level of shame felt!

Note: See TracTickets for help on using tickets.