summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-06-19 13:12:06 +0200
committerNoel Grandin <noel@peralex.com>2015-06-19 13:12:53 +0200
commit1352d166748ff730b11d9e165e302f7e9a1dc090 (patch)
treeb3c3453a057ada5849ff260ffe44a27a036ff82c /sdext
parent32b6002d46682819d440243aff4dd53556e89754 (diff)
workaround older compilers that do not have std::list::erase(const_iterator)
Change-Id: Iaa1164904febd8e97d4962e4004ec4719a1f4a42
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx10
-rw-r--r--sdext/source/pdfimport/tree/writertreevisiting.cxx9
2 files changed, 15 insertions, 4 deletions
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 0b2fad3aab54..66d20b44227a 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -452,8 +452,14 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
elem.Children.splice( elem.Children.end(), pNext->Children );
// workaround older compilers that do not have std::list::erase(const_iterator)
- std::list< Element* > tmp;
- tmp.splice( tmp.begin(), elem.Parent->Children, next_it, next_it);
+#if defined __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+ std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
+ std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
+ elem.Parent->Children.erase(tmpIt);
+#else
+ elem.Parent->Children.erase(next_it);
+#endif
+
delete pNext;
}
}
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 73d4d1991ac7..4759b1983aa2 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -403,8 +403,13 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
elem.Children.splice( elem.Children.end(), pNext->Children );
// workaround older compilers that do not have std::list::erase(const_iterator)
- std::list< Element* > tmp;
- tmp.splice( tmp.begin(), elem.Parent->Children, next_it, next_it);
+#if defined __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+ std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
+ std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
+ elem.Parent->Children.erase(tmpIt);
+#else
+ elem.Parent->Children.erase(next_it);
+#endif
delete pNext;
}
}