Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:34

0001 // Boost.Geometry Index
0002 //
0003 // Insert iterator
0004 //
0005 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
0006 //
0007 // Use, modification and distribution is subject to the Boost Software License,
0008 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_GEOMETRY_INDEX_INSERTER_HPP
0012 #define BOOST_GEOMETRY_INDEX_INSERTER_HPP
0013 
0014 #include <iterator>
0015 
0016 /*!
0017 \defgroup inserters Inserters (boost::geometry::index::)
0018 */
0019 
0020 namespace boost { namespace geometry { namespace index {
0021 
0022 template <class Container>
0023 class insert_iterator
0024 {
0025 public:
0026     typedef std::output_iterator_tag iterator_category;
0027     typedef void value_type;
0028     typedef void difference_type;
0029     typedef void pointer;
0030     typedef void reference;
0031 
0032     typedef Container container_type;
0033 
0034     inline explicit insert_iterator(Container & c)
0035         : container(&c)
0036     {}
0037 
0038     insert_iterator & operator=(typename Container::value_type const& value)
0039     {
0040         container->insert(value);
0041         return *this;
0042     }
0043 
0044     insert_iterator & operator* ()
0045     {
0046         return *this;
0047     }
0048 
0049     insert_iterator & operator++ ()
0050     {
0051         return *this;
0052     }
0053 
0054     insert_iterator operator++(int)
0055     {
0056         return *this;
0057     }
0058 
0059 private:
0060     Container * container;
0061 };
0062 
0063 /*!
0064 \brief Insert iterator generator.
0065 
0066 Returns insert iterator capable to insert values to the container
0067 (spatial index) which has member function insert(value_type const&) defined.
0068 
0069 \ingroup inserters
0070 
0071 \param c    The reference to the container (spatial index) to which values will be inserted.
0072 
0073 \return     The insert iterator inserting values to the container.
0074 */
0075 template <typename Container>
0076 insert_iterator<Container> inserter(Container & c)
0077 {
0078     return insert_iterator<Container>(c);
0079 }
0080 
0081 }}} // namespace boost::geometry::index
0082 
0083 #endif // BOOST_GEOMETRY_INDEX_INSERTER_HPP