Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80808 - in branches/release/boost/algorithm: . cxx11 searching searching/detail string string/detail
From: marshall_at_[hidden]
Date: 2012-10-01 11:31:53


Author: marshall
Date: 2012-10-01 11:31:51 EDT (Mon, 01 Oct 2012)
New Revision: 80808
URL: http://svn.boost.org/trac/boost/changeset/80808

Log:
Merge bug fixes to release; Fixes #7339
Properties modified:
   branches/release/boost/algorithm/ (props changed)
   branches/release/boost/algorithm/clamp.hpp (props changed)
   branches/release/boost/algorithm/cxx11/all_of.hpp (props changed)
   branches/release/boost/algorithm/cxx11/any_of.hpp (props changed)
   branches/release/boost/algorithm/cxx11/copy_if.hpp (props changed)
   branches/release/boost/algorithm/cxx11/copy_n.hpp (props changed)
   branches/release/boost/algorithm/cxx11/find_if_not.hpp (props changed)
   branches/release/boost/algorithm/cxx11/iota.hpp (props changed)
   branches/release/boost/algorithm/cxx11/is_partitioned.hpp (props changed)
   branches/release/boost/algorithm/cxx11/is_permutation.hpp (props changed)
   branches/release/boost/algorithm/cxx11/is_sorted.hpp (props changed)
   branches/release/boost/algorithm/cxx11/none_of.hpp (props changed)
   branches/release/boost/algorithm/cxx11/one_of.hpp (props changed)
   branches/release/boost/algorithm/cxx11/partition_copy.hpp (props changed)
   branches/release/boost/algorithm/cxx11/partition_point.hpp (props changed)
   branches/release/boost/algorithm/hex.hpp (contents, props changed)
   branches/release/boost/algorithm/searching/ (props changed)
   branches/release/boost/algorithm/searching/boyer_moore.hpp (props changed)
   branches/release/boost/algorithm/searching/boyer_moore_horspool.hpp (props changed)
   branches/release/boost/algorithm/searching/detail/bm_traits.hpp (props changed)
   branches/release/boost/algorithm/searching/detail/debugging.hpp (props changed)
   branches/release/boost/algorithm/searching/knuth_morris_pratt.hpp (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/algorithm/string/detail/case_conv.hpp (props changed)
   branches/release/boost/algorithm/string/detail/classification.hpp (props changed)
   branches/release/boost/algorithm/string/find.hpp (props changed)
Text files modified:
   branches/release/boost/algorithm/hex.hpp | 30 +++++++++++++++++-------------
   1 files changed, 17 insertions(+), 13 deletions(-)

Modified: branches/release/boost/algorithm/hex.hpp
==============================================================================
--- branches/release/boost/algorithm/hex.hpp (original)
+++ branches/release/boost/algorithm/hex.hpp 2012-10-01 11:31:51 EDT (Mon, 01 Oct 2012)
@@ -69,14 +69,18 @@
         return std::copy ( res, res + num_hex_digits, out );
         }
 
+// this needs to be in an un-named namespace because it is not a template
+// and might get included in several compilation units. This could cause
+// multiple definition errors at link time.
+ namespace {
     unsigned hex_char_to_int ( char c ) {
         if ( c >= '0' && c <= '9' ) return c - '0';
         if ( c >= 'A' && c <= 'F' ) return c - 'A' + 10;
         if ( c >= 'a' && c <= 'f' ) return c - 'a' + 10;
         BOOST_THROW_EXCEPTION (non_hex_input() << bad_char (c));
- return 0; // keep dumb compilers happy
+ return 0; // keep dumb compilers happy
         }
-
+ }
 
 // My own iterator_traits class.
 // It is here so that I can "reach inside" some kinds of output iterators
@@ -105,17 +109,17 @@
 // The first one is the output type, the second one is the character type of
 // the underlying stream, the third is the character traits.
 // We only care about the first one.
- template<typename T, typename charType, typename traits>
- struct hex_iterator_traits< std::ostream_iterator<T, charType, traits> > {
- typedef T value_type;
- };
-
- template <typename Iterator>
- bool iter_end ( Iterator current, Iterator last ) { return current == last; }
-
- template <typename T>
- bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; }
-
+ template<typename T, typename charType, typename traits>
+ struct hex_iterator_traits< std::ostream_iterator<T, charType, traits> > {
+ typedef T value_type;
+ };
+
+ template <typename Iterator>
+ bool iter_end ( Iterator current, Iterator last ) { return current == last; }
+
+ template <typename T>
+ bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; }
+
 // What can we assume here about the inputs?
 // is std::iterator_traits<InputIterator>::value_type always 'char' ?
 // Could it be wchar_t, say? Does it matter?


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