[Boost-bugs] [Boost C++ Libraries] #5450: range doesn't support circular_buffer

Subject: [Boost-bugs] [Boost C++ Libraries] #5450: range doesn't support circular_buffer
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-04-09 23:47:20


#5450: range doesn't support circular_buffer
------------------------------+---------------------------------------------
 Reporter: anonymous | Owner: neilgroves
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------------------------
 The range library doesn't seem to specialise for circular_buffer.

 Code bellow should fix the problem.

 It must be placed `some where' i.e. in `circular_buffer' path.

 {{{
 #!div style="font-size: 100%"
 Code highlighting:
   {{{#!cpp

 #include <boost/circular_buffer.hpp>

 #ifdef BOOST_PRAGMA_ONCE
 #pragma once
 #endif

 namespace boost
 {
         // Specialized metafunctions. We must include the range.hpp
 header.
         // We must open the 'boost' namespace.
         template< class T >
         struct range_mutable_iterator< circular_buffer<T> >
         {
                 typedef typename circular_buffer<T>::iterator type;
         };

         template< class T >
         struct range_const_iterator< circular_buffer<T> >
         {
                 typedef typename circular_buffer<T>::const_iterator type;
         };

         template<class T>
         inline typename circular_buffer<T>::iterator
                 range_begin( circular_buffer<T>& x )
         {
                 return x.begin();
         }

         template<class T>
         inline typename circular_buffer<T>::const_iterator
                 range_begin( const circular_buffer<T>& x )
         {
                 return x.begin();
         }

         template<class T>
         inline typename circular_buffer<T>::iterator
                 range_end( circular_buffer<T>& x )
         {
                 return x.end();
         }

         template<class T>
         inline typename circular_buffer<T>::const_iterator
                 range_end( const circular_buffer<T>& x )
         {
                 return x.end();
         }

 } // namespace boost

   }}}
 }}}

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