summaryrefslogtreecommitdiff
path: root/external/mdds
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-15 11:33:44 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-15 11:33:44 +0200
commit22aa9fce300f9953dc43fc75f8ced4caab5c3f83 (patch)
tree6ae53ca1faf5910efaafa466a6008f67cc0e0dd9 /external/mdds
parent6f019bea96e93c127ccd695d381647b48d06d710 (diff)
Avoid copying of singular iterators
Change-Id: If873d2c369ef6458fdf3289f09802e90dc7367f2
Diffstat (limited to 'external/mdds')
-rw-r--r--external/mdds/UnpackedTarball_mdds.mk1
-rw-r--r--external/mdds/mdds-c++98.patch.084
2 files changed, 85 insertions, 0 deletions
diff --git a/external/mdds/UnpackedTarball_mdds.mk b/external/mdds/UnpackedTarball_mdds.mk
index 387b8bcfacf9..974a8e126c9a 100644
--- a/external/mdds/UnpackedTarball_mdds.mk
+++ b/external/mdds/UnpackedTarball_mdds.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,3))
$(eval $(call gb_UnpackedTarball_add_patches,mdds,\
external/mdds/mdds_0.6.0.patch \
+ external/mdds/mdds-c++98.patch.0 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/mdds/mdds-c++98.patch.0 b/external/mdds/mdds-c++98.patch.0
new file mode 100644
index 000000000000..eaf1d60a86af
--- /dev/null
+++ b/external/mdds/mdds-c++98.patch.0
@@ -0,0 +1,84 @@
+--- include/mdds/multi_type_vector_itr.hpp
++++ include/mdds/multi_type_vector_itr.hpp
+@@ -139,14 +139,15 @@
+ typedef typename parent_type::size_type size_type;
+ typedef iterator_value_node<size_type, typename parent_type::element_block_type> node;
+
+- iterator_common_base() : m_cur_node(0, 0) {}
++ iterator_common_base() : m_cur_node(0, 0), m_singular(true) {}
+
+ iterator_common_base(
+ const base_iterator_type& pos, const base_iterator_type& end,
+ size_type start_pos, size_type block_index) :
+ m_cur_node(start_pos, block_index),
+ m_pos(pos),
+- m_end(end)
++ m_end(end),
++ m_singular(false)
+ {
+ if (m_pos != m_end)
+ update_node();
+@@ -154,9 +155,13 @@
+
+ iterator_common_base(const iterator_common_base& other) :
+ m_cur_node(other.m_cur_node),
+- m_pos(other.m_pos),
+- m_end(other.m_end)
++ m_singular(other.m_singular)
+ {
++ if (!m_singular)
++ {
++ m_pos = other.m_pos;
++ m_end = other.m_end;
++ }
+ }
+
+ void update_node()
+@@ -196,6 +201,7 @@
+ node m_cur_node;
+ base_iterator_type m_pos;
+ base_iterator_type m_end;
++ bool m_singular;
+
+ public:
+ bool operator== (const iterator_common_base& other) const
+@@ -218,8 +224,12 @@
+ iterator_common_base& operator= (const iterator_common_base& other)
+ {
+ m_cur_node = other.m_cur_node;
+- m_pos = other.m_pos;
+- m_end = other.m_end;
++ m_singular = other.m_singular;
++ if (!m_singular)
++ {
++ m_pos = other.m_pos;
++ m_end = other.m_end;
++ }
+ return *this;
+ }
+
+@@ -226,8 +236,22 @@
+ void swap(iterator_common_base& other)
+ {
+ m_cur_node.swap(other.m_cur_node);
+- std::swap(m_pos, other.m_pos);
+- std::swap(m_end, other.m_end);
++ std::swap(m_singular, other.m_singular);
++ if (!(m_singular || other.m_singular))
++ {
++ std::swap(m_pos, other.m_pos);
++ std::swap(m_end, other.m_end);
++ }
++ else if (!m_singular)
++ {
++ m_pos = other.m_pos;
++ m_end = other.m_end;
++ }
++ else if (!other.m_singular)
++ {
++ other.m_pos = m_pos;
++ other.m_end = m_end;
++ }
+ }
+
+ const node& get_node() const { return m_cur_node; }