Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/tr1/detail/functor2iterator.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 883 bytes
Line 
1//  (C) Copyright John Maddock 2005.
2//  Use, modification and distribution are subject to the
3//  Boost Software License, Version 1.0. (See accompanying file
4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef BOOST_TR1_FUNCTOR_IT_HPP_INCLUDED
7#  define BOOST_TR1_FUNCTOR_IT_HPP_INCLUDED
8
9# include <boost/iterator/iterator_facade.hpp>
10
11namespace boost{ namespace tr1_details{
12
13template <class Func, class R>
14struct functor2iterator : boost::iterator_facade<functor2iterator<Func,R>, const R, std::input_iterator_tag>
15{
16   functor2iterator() : m_func(0){}
17   functor2iterator(Func& f)
18      : m_func(&f)
19   {
20      m_val = (*m_func)();
21   }
22   const R& dereference()const
23   { return m_val; }
24   void increment(){ m_val = (*m_func)(); }
25   bool equal(const functor2iterator&)const
26   { return false; }
27private:
28   Func* m_func;
29   R m_val;
30};
31
32} }
33
34#endif
Note: See TracBrowser for help on using the repository browser.