Opened 11 years ago
#6216 new Feature Requests
Add an unwrap adaptor to Range
Reported by: | Owned by: | Neil Groves | |
---|---|---|---|
Milestone: | To Be Determined | Component: | range |
Version: | Boost 1.48.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Iterator adaptors can be easily unwrapped by calling iterator .base ()
; range adaptors should provide a similar functionality.
My implementation:
namespace boost { namespace adaptors { namespace detail { struct unwrap_forwarder {}; template < class P_R > inline ::boost:: iterator_range < typename ::boost:: range_iterator < P_R >:: type:: base_type > operator | (P_R const &p_r, detail:: unwrap_forwarder const &) { return ::boost:: make_iterator_range (::boost:: begin (p_r). base (), ::boost:: end (p_r). base ()); } /* !boost.adaptors.|unwrapped X */ } /* &boost.adaptors.detail X */ namespace { detail:: unwrap_forwarder const (&unwrapped) ((detail:: unwrap_forwarder ())); } } /* &boost.adaptors X */ } /* &boost X */
My test:
int main () { ::boost:: iterator_range < ::std:: string:: const_iterator > ((::boost:: equal_range (::std:: string () | ::boost:: adaptors:: transformed (::std:: negate < int > ()), 0) | ::boost:: adaptors:: unwrapped)); }
Note:
See TracTickets
for help on using tickets.