Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76454 - in sandbox/coerce/boost/coerce: . detail
From: vexocide_at_[hidden]
Date: 2012-01-13 10:49:23


Author: vexocide
Date: 2012-01-13 10:49:22 EST (Fri, 13 Jan 2012)
New Revision: 76454
URL: http://svn.boost.org/trac/boost/changeset/76454

Log:
Removed string_traits::length
Text files modified:
   sandbox/coerce/boost/coerce/detail/karma.hpp | 11 +++--------
   sandbox/coerce/boost/coerce/detail/qi.hpp | 17 ++++++-----------
   sandbox/coerce/boost/coerce/string.hpp | 28 +++++-----------------------
   3 files changed, 14 insertions(+), 42 deletions(-)

Modified: sandbox/coerce/boost/coerce/detail/karma.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/detail/karma.hpp (original)
+++ sandbox/coerce/boost/coerce/detail/karma.hpp 2012-01-13 10:49:22 EST (Fri, 13 Jan 2012)
@@ -1,4 +1,4 @@
-// Copyright Jeroen Habraken 2010 - 2011.
+// Copyright Jeroen Habraken 2010 - 2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file ../../../LICENSE_1_0.txt or copy at
@@ -31,17 +31,12 @@
             detail::call_reserve(
                 target, traits::reserve_size<Source, Tag>::call(source, tag));
 
- typename sequence_traits::iterator iterator =
- sequence_traits::back_inserter(target);
-
             typename Tag::template generator<
                 typename sequence_traits::iterator, Target, Source
> generator(tag);
 
- bool result = spirit::karma::generate(
- iterator, generator, source);
-
- return result;
+ return spirit::karma::generate(
+ sequence_traits::back_inserter(target), generator, source);
         }
     };
 

Modified: sandbox/coerce/boost/coerce/detail/qi.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/detail/qi.hpp (original)
+++ sandbox/coerce/boost/coerce/detail/qi.hpp 2012-01-13 10:49:22 EST (Fri, 13 Jan 2012)
@@ -1,4 +1,4 @@
-// Copyright Jeroen Habraken 2010 - 2011.
+// Copyright Jeroen Habraken 2010 - 2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file ../../../LICENSE_1_0.txt or copy at
@@ -28,25 +28,20 @@
         call(Target & target, Source const & source, Tag const & tag) {
             typedef traits::string_traits<Source> string_traits;
 
- typename string_traits::size_type
- length = string_traits::length(source);
- detail::call_reserve(target, length);
-
             typename string_traits::const_iterator
                 begin = string_traits::begin(source), iterator = begin;
 
+ typename string_traits::const_iterator
+ end = string_traits::end(source);
+
             typename Tag::template parser<
                 typename string_traits::const_iterator, Target, Source
> parser(tag);
 
             bool result = spirit::qi::parse(
- iterator, string_traits::end(source), parser, target);
-
- if (static_cast<typename string_traits::size_type>(iterator - begin) != length) {
- return false;
- }
+ iterator, end, parser, target);
 
- return result;
+ return result && (iterator == end);
         }
     };
 

Modified: sandbox/coerce/boost/coerce/string.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/string.hpp (original)
+++ sandbox/coerce/boost/coerce/string.hpp 2012-01-13 10:49:22 EST (Fri, 13 Jan 2012)
@@ -1,4 +1,4 @@
-// Copyright Jeroen Habraken 2011.
+// Copyright Jeroen Habraken 2011 - 2012.
 //
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file ../../LICENSE_1_0.txt or copy at
@@ -23,7 +23,6 @@
     template <typename T>
     struct string_traits_impl<T *> {
         typedef T const * const_iterator;
- typedef std::size_t size_type;
 
         static inline const_iterator
         begin(T * const value) {
@@ -32,21 +31,15 @@
 
         static inline const_iterator
         end(T * const value) {
- return value + length(value) + 1;
- }
-
- static inline size_type
- length(T * const value) {
- return std::char_traits<
- typename remove_const<T>::type
- >::length(value);
+ return value + std::char_traits<
+ typename remove_const<T>::type
+ >::length(value);
         }
     };
 
     template <typename T, std::size_t N>
     struct string_traits_impl<T [N]> {
         typedef T const * const_iterator;
- typedef std::size_t size_type;
 
         static inline const_iterator
         begin(T const(& value)[N]) {
@@ -55,12 +48,7 @@
 
         static inline const_iterator
         end(T const(& value)[N]) {
- return value + length(value);
- }
-
- static inline size_type
- length(T const(& value)[N]) {
- return value[N - 1] == 0 ? N - 1 : N;
+ return value + (value[N - 1] == 0 ? N - 1 : N);
         }
     };
 
@@ -69,7 +57,6 @@
         typedef std::basic_string<T, Traits, Allocator> type;
 
         typedef typename type::const_iterator const_iterator;
- typedef typename type::size_type size_type;
 
         static inline const_iterator
         begin(type const & value) {
@@ -80,11 +67,6 @@
         end(type const & value) {
             return value.end();
         }
-
- static inline size_type
- length(type const & value) {
- return value.length();
- }
     };
 
     template <typename T, typename Enable = void>


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