summaryrefslogtreecommitdiff
path: root/boost/shared_container_iterator.hpp
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 19:57:26 (GMT)
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 19:57:26 (GMT)
commit1a78a62555be32868418fe52f8e330c9d0f95d5a (patch)
treed3765a80e7d3b9640ec2e930743630cd6b9fce2b /boost/shared_container_iterator.hpp
downloadboost-1a78a62555be32868418fe52f8e330c9d0f95d5a.zip
boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.gz
boost-1a78a62555be32868418fe52f8e330c9d0f95d5a.tar.bz2
Imported Upstream version 1.49.0upstream/1.49.0
Diffstat (limited to 'boost/shared_container_iterator.hpp')
-rw-r--r--boost/shared_container_iterator.hpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/boost/shared_container_iterator.hpp b/boost/shared_container_iterator.hpp
new file mode 100644
index 0000000..7d8ecd3
--- /dev/null
+++ b/boost/shared_container_iterator.hpp
@@ -0,0 +1,62 @@
+// (C) Copyright Ronald Garcia 2002. 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.
+
+// See http://www.boost.org/libs/utility/shared_container_iterator.html for documentation.
+
+#ifndef SHARED_CONTAINER_ITERATOR_RG08102002_HPP
+#define SHARED_CONTAINER_ITERATOR_RG08102002_HPP
+
+#include "boost/iterator_adaptors.hpp"
+#include "boost/shared_ptr.hpp"
+#include <utility>
+
+namespace boost {
+
+template <typename Container>
+class shared_container_iterator : public iterator_adaptor<
+ shared_container_iterator<Container>,
+ typename Container::iterator> {
+
+ typedef iterator_adaptor<
+ shared_container_iterator<Container>,
+ typename Container::iterator> super_t;
+
+ typedef typename Container::iterator iterator_t;
+ typedef boost::shared_ptr<Container> container_ref_t;
+
+ container_ref_t container_ref;
+public:
+ shared_container_iterator() { }
+
+ shared_container_iterator(iterator_t const& x,container_ref_t const& c) :
+ super_t(x), container_ref(c) { }
+
+
+};
+
+template <typename Container>
+shared_container_iterator<Container>
+make_shared_container_iterator(typename Container::iterator iter,
+ boost::shared_ptr<Container> const& container) {
+ typedef shared_container_iterator<Container> iterator;
+ return iterator(iter,container);
+}
+
+
+
+template <typename Container>
+std::pair<
+ shared_container_iterator<Container>,
+ shared_container_iterator<Container> >
+make_shared_container_range(boost::shared_ptr<Container> const& container) {
+ return
+ std::make_pair(
+ make_shared_container_iterator(container->begin(),container),
+ make_shared_container_iterator(container->end(),container));
+}
+
+
+} // namespace boost
+#endif // SHARED_CONTAINER_ITERATOR_RG08102002_HPP