17 #ifndef NUKLEI_SHARED_CONTAINER_ITERATOR_HPP
18 #define NUKLEI_SHARED_CONTAINER_ITERATOR_HPP
23 #include <boost/iterator.hpp>
24 #include <boost/iterator/iterator_categories.hpp>
25 #include <boost/iterator/iterator_adaptor.hpp>
26 #include <boost/shared_ptr.hpp>
30 template<
class Container,
class ContainerIterator>
36 template<
class Container,
class ContainerIterator>
39 typedef Container container_t;
40 typedef ContainerIterator container_iterator;
41 typedef boost::shared_ptr<Container> container_ptr;
43 typedef boost::iterator_adaptor<
46 typename boost::detail::iterator_traits<ContainerIterator>::value_type,
48 typename boost::detail::iterator_traits<ContainerIterator>::reference
54 template<
class Container,
class ContainerIterator>
59 typedef typename base_t::type super_t;
61 friend class boost::iterator_core_access;
65 typedef typename base_t::container_t container_t;
66 typedef typename base_t::container_ptr container_ptr;
67 typedef typename base_t::container_iterator container_iterator;
70 m_collection(new container_t)
73 shared_container_iterator(container_ptr& index_collection)
74 : super_t(index_collection->
begin()),
75 m_collection(index_collection)
88 template<
class OtherContainerIterator>
89 shared_container_iterator
91 typename boost::enable_if_convertible<OtherContainerIterator, ContainerIterator>::type* = 0) :
93 m_collection(r.m_collection)
103 iterator.base_reference() =
104 iterator.m_collection->begin();
115 iterator.base_reference() =
116 iterator.m_collection->end();
122 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
128 container_ptr m_collection;
133 #endif // include guard