X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Fgenerator_iterator.hpp;h=ebf478b25b773724b270cd6805f07ddea58f255f;hb=b01a9dc187d9cd396a57463ad27511379dcdc9cd;hp=5f4c0a93cdde830d1c8291ae9261eae142a5b8f0;hpb=59b6a4701a8d2b5155af08cf758b4ca120201282;p=lyx.git diff --git a/boost/boost/generator_iterator.hpp b/boost/boost/generator_iterator.hpp index 5f4c0a93cd..ebf478b25b 100644 --- a/boost/boost/generator_iterator.hpp +++ b/boost/boost/generator_iterator.hpp @@ -1,68 +1,75 @@ -// (C) Copyright Jens Maurer 2001. Permission to copy, use, -// modify, sell and distribute this software is granted provided this -// copyright notice appears in all copies. This software is provided -// "as is" without express or implied warranty, and with no claim as -// to its suitability for any purpose. +// (C) Copyright Jens Maurer 2001. +// 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) // // Revision History: // 15 Nov 2001 Jens Maurer // created. +// See http://www.boost.org/libs/utility/iterator_adaptors.htm for documentation. + #ifndef BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP #define BOOST_ITERATOR_ADAPTOR_GENERATOR_ITERATOR_HPP -#include +#include #include namespace boost { template -class generator_iterator_policies +class generator_iterator + : public iterator_facade< + generator_iterator + , typename Generator::result_type + , single_pass_traversal_tag + , typename Generator::result_type const& + > { -public: - generator_iterator_policies() { } - - template - void initialize(Base& base) { - m_value = (*base)(); - } - - // The Iter template argument is necessary for compatibility with a MWCW - // bug workaround - template - void increment(IteratorAdaptor& iter) { - m_value = (*iter.base())(); + typedef iterator_facade< + generator_iterator + , typename Generator::result_type + , single_pass_traversal_tag + , typename Generator::result_type const& + > super_t; + + public: + generator_iterator() {} + generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {} + + void increment() + { + m_value = (*m_g)(); } - template const typename Generator::result_type& - dereference(const IteratorAdaptor&) const - { return m_value; } + dereference() const + { + return m_value; + } - template - bool equal(const IteratorAdaptor1& x, const IteratorAdaptor2& y) const - { return x.base() == y.base() && - x.policies().m_value == y.policies().m_value; } + bool equal(generator_iterator const& y) const + { + return this->m_g == y.m_g && this->m_value == y.m_value; + } -private: - typename Generator::result_type m_value; + private: + Generator* m_g; + typename Generator::result_type m_value; }; template struct generator_iterator_generator { - typedef iterator_adaptor, - typename Generator::result_type, const typename Generator::result_type&, - const typename Generator::result_type*, std::input_iterator_tag, - long> type; + typedef generator_iterator type; }; template -inline typename generator_iterator_generator::type +inline generator_iterator make_generator_iterator(Generator & gen) { - typedef typename generator_iterator_generator::type result_t; + typedef generator_iterator result_t; return result_t(&gen); }