annotate DEPENDENCIES/generic/include/boost/algorithm/string/detail/util.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost string_algo library util.hpp header file ---------------------------//
Chris@16 2
Chris@16 3 // Copyright Pavol Droba 2002-2003.
Chris@16 4 //
Chris@16 5 // Distributed under the Boost Software License, Version 1.0.
Chris@16 6 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8
Chris@16 9 // See http://www.boost.org/ for updates, documentation, and revision history.
Chris@16 10
Chris@16 11 #ifndef BOOST_STRING_UTIL_DETAIL_HPP
Chris@16 12 #define BOOST_STRING_UTIL_DETAIL_HPP
Chris@16 13
Chris@16 14 #include <boost/algorithm/string/config.hpp>
Chris@16 15 #include <functional>
Chris@16 16 #include <boost/range/iterator_range_core.hpp>
Chris@16 17
Chris@16 18 namespace boost {
Chris@16 19 namespace algorithm {
Chris@16 20 namespace detail {
Chris@16 21
Chris@16 22 // empty container -----------------------------------------------//
Chris@16 23
Chris@16 24 // empty_container
Chris@16 25 /*
Chris@16 26 This class represents always empty container,
Chris@16 27 containing elements of type CharT.
Chris@16 28
Chris@16 29 It is supposed to be used in a const version only
Chris@16 30 */
Chris@16 31 template< typename CharT >
Chris@16 32 struct empty_container
Chris@16 33 {
Chris@16 34 typedef empty_container<CharT> type;
Chris@16 35 typedef CharT value_type;
Chris@16 36 typedef std::size_t size_type;
Chris@16 37 typedef std::ptrdiff_t difference_type;
Chris@16 38 typedef const value_type& reference;
Chris@16 39 typedef const value_type& const_reference;
Chris@16 40 typedef const value_type* iterator;
Chris@16 41 typedef const value_type* const_iterator;
Chris@16 42
Chris@16 43
Chris@16 44 // Operations
Chris@16 45 const_iterator begin() const
Chris@16 46 {
Chris@16 47 return reinterpret_cast<const_iterator>(0);
Chris@16 48 }
Chris@16 49
Chris@16 50 const_iterator end() const
Chris@16 51 {
Chris@16 52 return reinterpret_cast<const_iterator>(0);
Chris@16 53 }
Chris@16 54
Chris@16 55 bool empty() const
Chris@16 56 {
Chris@16 57 return false;
Chris@16 58 }
Chris@16 59
Chris@16 60 size_type size() const
Chris@16 61 {
Chris@16 62 return 0;
Chris@16 63 }
Chris@16 64 };
Chris@16 65
Chris@16 66 // bounded copy algorithm -----------------------------------------------//
Chris@16 67
Chris@16 68 // Bounded version of the std::copy algorithm
Chris@16 69 template<typename InputIteratorT, typename OutputIteratorT>
Chris@16 70 inline OutputIteratorT bounded_copy(
Chris@16 71 InputIteratorT First,
Chris@16 72 InputIteratorT Last,
Chris@16 73 OutputIteratorT DestFirst,
Chris@16 74 OutputIteratorT DestLast )
Chris@16 75 {
Chris@16 76 InputIteratorT InputIt=First;
Chris@16 77 OutputIteratorT OutputIt=DestFirst;
Chris@16 78 for(; InputIt!=Last && OutputIt!=DestLast; InputIt++, OutputIt++ )
Chris@16 79 {
Chris@16 80 *OutputIt=*InputIt;
Chris@16 81 }
Chris@16 82
Chris@16 83 return OutputIt;
Chris@16 84 }
Chris@16 85
Chris@16 86 // iterator range utilities -----------------------------------------//
Chris@16 87
Chris@16 88 // copy range functor
Chris@16 89 template<
Chris@16 90 typename SeqT,
Chris@16 91 typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator >
Chris@16 92 struct copy_iterator_rangeF :
Chris@16 93 public std::unary_function< iterator_range<IteratorT>, SeqT >
Chris@16 94 {
Chris@16 95 SeqT operator()( const iterator_range<IteratorT>& Range ) const
Chris@16 96 {
Chris@16 97 return copy_range<SeqT>(Range);
Chris@16 98 }
Chris@16 99 };
Chris@16 100
Chris@16 101 } // namespace detail
Chris@16 102 } // namespace algorithm
Chris@16 103 } // namespace boost
Chris@16 104
Chris@16 105
Chris@16 106 #endif // BOOST_STRING_UTIL_DETAIL_HPP