| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | //  Boost string_algo library util.hpp header file  ---------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-27 10:27:37 +00:00
										 |  |  | //  Copyright Pavol Droba 2002-2003.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // 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)
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-27 10:27:37 +00:00
										 |  |  | //  See http://www.boost.org/ for updates, documentation, and revision history.
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef BOOST_STRING_UTIL_DETAIL_HPP
 | 
					
						
							|  |  |  | #define BOOST_STRING_UTIL_DETAIL_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/algorithm/string/config.hpp>
 | 
					
						
							|  |  |  | #include <functional>
 | 
					
						
							| 
									
										
										
										
											2013-09-17 20:37:20 +00:00
										 |  |  | #include <boost/range/iterator_range_core.hpp>
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace boost { | 
					
						
							|  |  |  |     namespace algorithm { | 
					
						
							|  |  |  |         namespace detail { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  empty container  -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             //  empty_container 
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							|  |  |  |                 This class represents always empty container, | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  |                 containing elements of type CharT. | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 It is supposed to be used in a const version only | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template< typename CharT > | 
					
						
							|  |  |  |             struct empty_container  | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 typedef empty_container<CharT> type;         | 
					
						
							|  |  |  |                 typedef CharT value_type; | 
					
						
							|  |  |  |                 typedef std::size_t size_type; | 
					
						
							|  |  |  |                 typedef std::ptrdiff_t difference_type; | 
					
						
							|  |  |  |                 typedef const value_type& reference; | 
					
						
							|  |  |  |                 typedef const value_type& const_reference; | 
					
						
							|  |  |  |                 typedef const value_type* iterator; | 
					
						
							|  |  |  |                 typedef const value_type* const_iterator; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                  | 
					
						
							|  |  |  |                 // Operations
 | 
					
						
							|  |  |  |                 const_iterator begin() const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     return reinterpret_cast<const_iterator>(0); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 const_iterator end() const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     return reinterpret_cast<const_iterator>(0); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 bool empty() const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     return false; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 size_type size() const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     return 0; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | //  bounded copy algorithm  -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // Bounded version of the std::copy algorithm
 | 
					
						
							|  |  |  |             template<typename InputIteratorT, typename OutputIteratorT> | 
					
						
							|  |  |  |             inline OutputIteratorT bounded_copy( | 
					
						
							|  |  |  |                 InputIteratorT First,  | 
					
						
							|  |  |  |                 InputIteratorT Last,  | 
					
						
							|  |  |  |                 OutputIteratorT DestFirst, | 
					
						
							|  |  |  |                 OutputIteratorT DestLast ) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 InputIteratorT InputIt=First; | 
					
						
							|  |  |  |                 OutputIteratorT OutputIt=DestFirst; | 
					
						
							|  |  |  |                 for(; InputIt!=Last && OutputIt!=DestLast; InputIt++, OutputIt++ ) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     *OutputIt=*InputIt; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 return OutputIt; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  iterator range utilities -----------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // copy range functor
 | 
					
						
							|  |  |  |             template<  | 
					
						
							|  |  |  |                 typename SeqT,  | 
					
						
							|  |  |  |                 typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator > | 
					
						
							| 
									
										
										
										
											2016-11-20 17:02:49 -08:00
										 |  |  |             struct copy_iterator_rangeF | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2016-11-20 17:02:49 -08:00
										 |  |  |                 typedef iterator_range<IteratorT> argument_type; | 
					
						
							|  |  |  |                 typedef SeqT result_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 SeqT operator()( const iterator_range<IteratorT>& Range ) const | 
					
						
							|  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  |                     return copy_range<SeqT>(Range); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } // namespace detail
 | 
					
						
							|  |  |  |     } // namespace algorithm
 | 
					
						
							|  |  |  | } // namespace boost
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif  // BOOST_STRING_UTIL_DETAIL_HPP
 |