BVB Source Codes

mars Show util.hpp Source code

Return Download mars: download util.hpp Source code - Download mars Source code - Type:.hpp
  1. //  Boost string_algo library util.hpp header file  ---------------------------//
  2.  
  3. //  Copyright Pavol Droba 2002-2003.
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. //    (See accompanying file LICENSE_1_0.txt or copy at
  7. //          http://www.boost.org/LICENSE_1_0.txt)
  8.  
  9. //  See http://www.boost.org/ for updates, documentation, and revision history.
  10.  
  11. #ifndef BOOST_STRING_UTIL_DETAIL_HPP
  12. #define BOOST_STRING_UTIL_DETAIL_HPP
  13.  
  14. #include <boost/algorithm/string/config.hpp>
  15. #include <functional>
  16. #include <boost/range/iterator_range_core.hpp>
  17.  
  18. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
  19.     namespace algorithm {
  20.         namespace detail {
  21.  
  22. //  empty container  -----------------------------------------------//
  23.  
  24.             //  empty_container
  25.             /*
  26.                 This class represents always empty container,
  27.                 containing elements of type CharT.
  28.  
  29.                 It is supposed to be used in a const version only
  30.             */
  31.             template< typename CharT >
  32.             struct empty_container
  33.             {
  34.                 typedef empty_container<CharT> type;        
  35.                 typedef CharT value_type;
  36.                 typedef std::size_t size_type;
  37.                 typedef std::ptrdiff_t difference_type;
  38.                 typedef const value_type& reference;
  39.                 typedef const value_type& const_reference;
  40.                 typedef const value_type* iterator;
  41.                 typedef const value_type* const_iterator;
  42.  
  43.                
  44.                 // Operations
  45.                 const_iterator begin() const
  46.                 {
  47.                     return reinterpret_cast<const_iterator>(0);
  48.                 }
  49.  
  50.                 const_iterator end() const
  51.                 {
  52.                     return reinterpret_cast<const_iterator>(0);
  53.                 }
  54.  
  55.                 bool empty() const
  56.                 {
  57.                     return false;
  58.                 }
  59.  
  60.                 size_type size() const
  61.                 {
  62.                     return 0;
  63.                 }
  64.             };
  65.    
  66. //  bounded copy algorithm  -----------------------------------------------//
  67.  
  68.             // Bounded version of the std::copy algorithm
  69.             template<typename InputIteratorT, typename OutputIteratorT>
  70.             inline OutputIteratorT bounded_copy(
  71.                 InputIteratorT First,
  72.                 InputIteratorT Last,
  73.                 OutputIteratorT DestFirst,
  74.                 OutputIteratorT DestLast )
  75.             {
  76.                 InputIteratorT InputIt=First;
  77.                 OutputIteratorT OutputIt=DestFirst;
  78.                 for(; InputIt!=Last && OutputIt!=DestLast; InputIt++, OutputIt++ )
  79.                 {
  80.                     *OutputIt=*InputIt;
  81.                 }
  82.  
  83.                 return OutputIt;
  84.             }
  85.  
  86. //  iterator range utilities -----------------------------------------//
  87.  
  88.             // copy range functor
  89.             template<
  90.                 typename SeqT,
  91.                 typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator >
  92.             struct copy_iterator_rangeF :
  93.                 public std::unary_function< iterator_range<IteratorT>, SeqT >
  94.             {
  95.                 SeqT operator()( const iterator_range<IteratorT>& Range ) const
  96.                 {
  97.                     return copy_range<SeqT>(Range);
  98.                 }
  99.             };
  100.  
  101.         } // namespace detail
  102.     } // namespace algorithm
  103. } // namespace mars_boost
  104.  
  105.  
  106. #endif  // BOOST_STRING_UTIL_DETAIL_HPP
  107.  
downloadutil.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top