Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76384 - trunk/boost/spirit/home/support/iterators/detail
From: hartmut.kaiser_at_[hidden]
Date: 2012-01-09 08:53:15


Author: hkaiser
Date: 2012-01-09 08:53:14 EST (Mon, 09 Jan 2012)
New Revision: 76384
URL: http://svn.boost.org/trac/boost/changeset/76384

Log:
Spirit: fixed #6368: [multi_pass] clear_queue isn't forwarded to the storage policy
Text files modified:
   trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp | 162 ++++++++++++++++++++++++++-------------
   1 files changed, 109 insertions(+), 53 deletions(-)

Modified: trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp (original)
+++ trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp 2012-01-09 08:53:14 EST (Mon, 09 Jan 2012)
@@ -1,5 +1,5 @@
-// Copyright (c) 2001-2011 Hartmut Kaiser
-//
+// Copyright (c) 2001-2012 Hartmut Kaiser
+//
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
@@ -12,21 +12,21 @@
 namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
- // The purpose of the multi_pass_unique template is to eliminate
- // empty policy classes (policies not containing any data items) from the
- // multiple inheritance chain. This is necessary since some compilers
- // fail to apply the empty base optimization if multiple inheritance is
+ // The purpose of the multi_pass_unique template is to eliminate
+ // empty policy classes (policies not containing any data items) from the
+ // multiple inheritance chain. This is necessary since some compilers
+ // fail to apply the empty base optimization if multiple inheritance is
     // involved.
- // Additionally this can be used to combine separate policies into one
+ // Additionally this can be used to combine separate policies into one
     // single multi_pass_policy as required by the multi_pass template
     ///////////////////////////////////////////////////////////////////////////
 
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- // without partial template specialization there is nothing much to do in
+ // without partial template specialization there is nothing much to do in
     // terms of empty base optimization anyways...
- template <typename T, typename Ownership, typename Checking,
+ template <typename T, typename Ownership, typename Checking,
         typename Input, typename Storage>
- struct multi_pass_unique
+ struct multi_pass_unique
       : Ownership, Checking, Input, Storage
     {
         multi_pass_unique() {}
@@ -41,13 +41,21 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Ownership::swap(x);
             this->Checking::swap(x);
             this->Input::swap(x);
             this->Storage::swap(x);
         }
+
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
     };
 #else
     ///////////////////////////////////////////////////////////////////////////
@@ -78,15 +86,23 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Ownership::swap(x);
             this->Checking::swap(x);
             this->Input::swap(x);
             this->Storage::swap(x);
         }
+
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, typename Ownership, typename Checking
       , typename Input, typename Storage>
@@ -105,13 +121,21 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Ownership::swap(x);
             this->Checking::swap(x);
             this->Storage::swap(x);
         }
 
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
+
         // implement input policy functions by forwarding to the Input type
         template <typename MultiPass>
         inline static void advance_input(MultiPass& mp)
@@ -148,21 +172,25 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Ownership::swap(x);
             this->Input::swap(x);
             this->Storage::swap(x);
         }
 
- // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
- inline static void docheck(MultiPass const& mp)
- { Checking::docheck(mp); }
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
 
+ // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
- inline static void clear_queue(MultiPass& mp)
- { Checking::clear_queue(mp); }
+ inline static void docheck(MultiPass const& mp)
+ { Checking::docheck(mp); }
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -182,12 +210,20 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Ownership::swap(x);
             this->Storage::swap(x);
         }
 
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
+
         // implement input policy functions by forwarding to the Input type
         template <typename MultiPass>
         inline static void advance_input(MultiPass& mp)
@@ -207,12 +243,8 @@
 
         // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
- inline static void docheck(MultiPass const& mp)
+ inline static void docheck(MultiPass const& mp)
             { Checking::docheck(mp); }
-
- template <typename MultiPass>
- inline static void clear_queue(MultiPass& mp)
- { Checking::clear_queue(mp); }
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -233,16 +265,24 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Checking::swap(x);
             this->Input::swap(x);
             this->Storage::swap(x);
         }
 
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
+
         // ownership policy functions are forwarded to the Ownership type
         template <typename MultiPass>
- inline static void clone(MultiPass& mp)
+ inline static void clone(MultiPass& mp)
             { Ownership::clone(mp); }
 
         template <typename MultiPass>
@@ -271,12 +311,20 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Checking::swap(x);
             this->Storage::swap(x);
         }
 
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
+
         // implement input policy functions by forwarding to the Input type
         template <typename MultiPass>
         inline static void advance_input(MultiPass& mp)
@@ -296,7 +344,7 @@
 
         // ownership policy functions are forwarded to the Ownership type
         template <typename MultiPass>
- inline static void clone(MultiPass& mp)
+ inline static void clone(MultiPass& mp)
             { Ownership::clone(mp); }
 
         template <typename MultiPass>
@@ -325,24 +373,28 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Input::swap(x);
             this->Storage::swap(x);
         }
 
- // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
- inline static void docheck(MultiPass const& mp)
- { Checking::docheck(mp); }
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
 
+ // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
- inline static void clear_queue(MultiPass& mp)
- { Checking::clear_queue(mp); }
+ inline static void docheck(MultiPass const& mp)
+ { Checking::docheck(mp); }
 
         // ownership policy functions are forwarded to the Ownership type
         template <typename MultiPass>
- inline static void clone(MultiPass& mp)
+ inline static void clone(MultiPass& mp)
             { Ownership::clone(mp); }
 
         template <typename MultiPass>
@@ -370,11 +422,19 @@
             Input::destroy(mp);
             Storage::destroy(mp);
         }
- void swap(multi_pass_unique& x)
+
+ void swap(multi_pass_unique& x)
         {
             this->Storage::swap(x);
         }
 
+ template <typename MultiPass>
+ inline static void clear_queue(MultiPass& mp)
+ {
+ Checking::clear_queue(mp);
+ Storage::clear_queue(mp);
+ }
+
         // implement input policy functions by forwarding to the Input type
         template <typename MultiPass>
         inline static void advance_input(MultiPass& mp)
@@ -394,16 +454,12 @@
 
         // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
- inline static void docheck(MultiPass const& mp)
+ inline static void docheck(MultiPass const& mp)
             { Checking::docheck(mp); }
 
- template <typename MultiPass>
- inline static void clear_queue(MultiPass& mp)
- { Checking::clear_queue(mp); }
-
         // ownership policy functions are forwarded to the Ownership type
         template <typename MultiPass>
- inline static void clone(MultiPass& mp)
+ inline static void clone(MultiPass& mp)
             { Ownership::clone(mp); }
 
         template <typename MultiPass>
@@ -417,7 +473,7 @@
 #endif
 
     ///////////////////////////////////////////////////////////////////////////
- // the multi_pass_shared structure is used to combine the shared data items
+ // the multi_pass_shared structure is used to combine the shared data items
     // of all policies into one single structure
     ///////////////////////////////////////////////////////////////////////////
     template<typename T, typename Ownership, typename Checking, typename Input
@@ -451,7 +507,7 @@
         {
             typedef typename Ownership::unique ownership_policy;
             typedef typename Checking::unique checking_policy;
- typedef typename Input::BOOST_NESTED_TEMPLATE unique<T>
+ typedef typename Input::BOOST_NESTED_TEMPLATE unique<T>
                 input_policy;
             typedef typename Storage::BOOST_NESTED_TEMPLATE unique<
                 typename input_policy::value_type> storage_policy;
@@ -470,26 +526,26 @@
           , typename Ownership::shared, typename Checking::shared
           , typename Input::BOOST_NESTED_TEMPLATE shared<T>
           , typename Storage::BOOST_NESTED_TEMPLATE shared<
- typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type> >
+ typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type> >
         {
             typedef typename Ownership::shared ownership_policy;
             typedef typename Checking::shared checking_policy;
- typedef typename Input::BOOST_NESTED_TEMPLATE shared<T>
+ typedef typename Input::BOOST_NESTED_TEMPLATE shared<T>
                 input_policy;
             typedef typename Storage::BOOST_NESTED_TEMPLATE shared<
- typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type>
+ typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type>
             storage_policy;
 
             typedef multi_pass_shared<T, ownership_policy, checking_policy
               , input_policy, storage_policy> shared_base_type;
 
- explicit shared(T& input)
+ explicit shared(T& input)
               : shared_base_type(input), inhibit_clear_queue_(false) {}
- explicit shared(T const& input)
+ explicit shared(T const& input)
               : shared_base_type(input), inhibit_clear_queue_(false) {}
 
- // This is needed for the correct implementation of expectation
- // points. Normally expectation points flush any multi_pass
+ // This is needed for the correct implementation of expectation
+ // points. Normally expectation points flush any multi_pass
             // iterator they may act on, but if the corresponding error handler
             // is of type 'retry' no flushing of the internal buffers should be
             // executed (even if explicitly requested).


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk