Subject: [Boost-bugs] [Boost C++ Libraries] #6216: Add an unwrap adaptor to Range
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-05 16:28:51
#6216: Add an unwrap adaptor to Range
---------------------------------+------------------------------------------
Reporter: ne01026@⦠| Owner: neilgroves
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: range
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
---------------------------------+------------------------------------------
Iterator adaptors can be easily unwrapped by calling `iterator .base ()`;
range adaptors should provide a similar functionality.
My implementation:
{{{
#!cpp
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:
{{{
#!cpp
int main ()
{ ::boost:: iterator_range < ::std:: string:: const_iterator >
((::boost:: equal_range
(::std:: string ()
| ::boost:: adaptors:: transformed (::std:: negate < int > ()), 0)
| ::boost:: adaptors:: unwrapped)); }
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6216> 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:08 UTC