BVB Source Codes

mars Show function_output_iterator.hpp Source code

Return Download mars: download function_output_iterator.hpp Source code - Download mars Source code - Type:.hpp
  1. // (C) Copyright Jeremy Siek 2001.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5.  
  6. // Revision History:
  7.  
  8. // 27 Feb 2001   Jeremy Siek
  9. //      Initial checkin.
  10.  
  11. #ifndef BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
  12. #define BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
  13.  
  14. #include <iterator>
  15.  
  16. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
  17. namespace iterators {
  18.  
  19.   template <class UnaryFunction>
  20.   class function_output_iterator {
  21.     typedef function_output_iterator self;
  22.   public:
  23.     typedef std::output_iterator_tag iterator_category;
  24.     typedef void                value_type;
  25.     typedef void                difference_type;
  26.     typedef void                pointer;
  27.     typedef void                reference;
  28.  
  29.     explicit function_output_iterator() {}
  30.  
  31.     explicit function_output_iterator(const UnaryFunction& f)
  32.       : m_f(f) {}
  33.  
  34.     struct output_proxy {
  35.       output_proxy(UnaryFunction& f) : m_f(f) { }
  36.       template <class T> output_proxy& operator=(const T& value) {
  37.         m_f(value);
  38.         return *this;
  39.       }
  40.       UnaryFunction& m_f;
  41.     };
  42.     output_proxy operator*() { return output_proxy(m_f); }
  43.     self& operator++() { return *this; }
  44.     self& operator++(int) { return *this; }
  45.   private:
  46.     UnaryFunction m_f;
  47.   };
  48.  
  49.   template <class UnaryFunction>
  50.   inline function_output_iterator<UnaryFunction>
  51.   make_function_output_iterator(const UnaryFunction& f = UnaryFunction()) {
  52.     return function_output_iterator<UnaryFunction>(f);
  53.   }
  54.  
  55. } // namespace iterators
  56.  
  57. using iterators::function_output_iterator;
  58. using iterators::make_function_output_iterator;
  59.  
  60. } // namespace mars_boost
  61.  
  62. #endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP
  63.  
downloadfunction_output_iterator.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