summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-03 16:59:01 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-03 16:59:01 +0100
commit4afd260197d3db27cd7ac46c0e2bff6d4bc84536 (patch)
tree1faf5a2e802fb32f23c2562c5e9597413726015a /sot
parentd0dcf1d65c79c4c607a1ac24c0c57f4b1a935294 (diff)
std::is_sorted is C++11 or C++0X sgi extension
Change-Id: I3039bb172beb21ebafc60a431692b58793cb1538
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgstrms.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 3441b823cc13..ec57730fa819 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -334,6 +334,27 @@ void StgStrm::SetEntry( StgDirEntry& r )
r.SetDirty();
}
+namespace lcl
+{
+#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+ using std::is_sorted;
+#else
+ template <typename iter> bool is_sorted(iter aStart, iter aEnd)
+ {
+ if (aStart == aEnd)
+ return true;
+
+ for (iter aNext = aStart + 1; aNext != aEnd; aStart = aNext, ++aNext)
+ {
+ if (*aNext < *aStart)
+ return false;
+ }
+
+ return true;
+ }
+#endif
+}
+
bool StgStrm::buildPageChainCache()
{
if (nSize > 0)
@@ -349,7 +370,7 @@ bool StgStrm::buildPageChainCache()
return false;
}
- m_bSortedPageChain = std::is_sorted(m_aPagesCache.begin(), m_aPagesCache.end());
+ m_bSortedPageChain = lcl::is_sorted(m_aPagesCache.begin(), m_aPagesCache.end());
SAL_WARN_IF(!m_bSortedPageChain, "sot", "unsorted page chain, that's suspicious");