Boost logo

Boost-Commit :

From: joel_at_[hidden]
Date: 2008-04-17 05:44:32


Author: djowel
Date: 2008-04-17 05:44:31 EDT (Thu, 17 Apr 2008)
New Revision: 44493
URL: http://svn.boost.org/trac/boost/changeset/44493

Log:
fixed redundancy in namespace qi::detail::detail
Text files modified:
   trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp | 49 ++++++++++++++++++---------------------
   1 files changed, 23 insertions(+), 26 deletions(-)

Modified: trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp (original)
+++ trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp 2008-04-17 05:44:31 EDT (Thu, 17 Apr 2008)
@@ -14,37 +14,34 @@
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
- namespace detail
+ template <typename Run, typename Iterator, typename Range>
+ inline bool
+ try_merge(Run& run, Iterator iter, Range const& range)
     {
- template <typename Run, typename Iterator, typename Range>
- inline bool
- try_merge(Run& run, Iterator iter, Range const& range)
+ // if *iter intersects with, or is adjacent to, 'range'...
+ if (can_merge(*iter, range))
         {
- // if *iter intersects with, or is adjacent to, 'range'...
- if (can_merge(*iter, range))
- {
- typedef typename Range::value_type value_type;
- typedef integer_traits<value_type> integer_traits;
+ typedef typename Range::value_type value_type;
+ typedef integer_traits<value_type> integer_traits;
 
- // merge range and *iter
- merge(*iter, range);
+ // merge range and *iter
+ merge(*iter, range);
 
- // collapse all subsequent ranges that can merge with *iter
- Iterator i;
- value_type last =
- iter->last == integer_traits::const_max
- ? iter->last : iter->last+1;
+ // collapse all subsequent ranges that can merge with *iter
+ Iterator i;
+ value_type last =
+ iter->last == integer_traits::const_max
+ ? iter->last : iter->last+1;
 
- for (i = iter+1; i != run.end() && last >= i->first; ++i)
- {
- iter->last = i->last;
- }
- // erase all ranges that were collapsed
- run.erase(iter+1, i);
- return true;
+ for (i = iter+1; i != run.end() && last >= i->first; ++i)
+ {
+ iter->last = i->last;
             }
- return false;
+ // erase all ranges that were collapsed
+ run.erase(iter+1, i);
+ return true;
         }
+ return false;
     }
 
     template <typename Char>
@@ -100,14 +97,14 @@
             }
 
             // if *(iter-1) can merge with 'range', merge them and return
- if (detail::try_merge(run, iter-1, range))
+ if (try_merge(run, iter-1, range))
             {
                 return;
             }
         }
 
         // if *iter can merge with with 'range', merge them
- if (iter == run.end() || !detail::try_merge(run, iter, range))
+ if (iter == run.end() || !try_merge(run, iter, range))
         {
             // no overlap, insert 'range'
             run.insert(iter, range);


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