summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-08-26 15:04:47 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-08-26 17:51:01 +0200
commitb5317b2a41e6369e2804462e2ab73f1447f1533a (patch)
tree6566ad507e0ca0f80b438fea271ef0302b396591 /include
parent412e9008db400d925cb85c9ae5146f8558735aa5 (diff)
Introduce Sequence::size() instead of specialization of std::size
Change-Id: Id0889a1b51449f3812ba875919595a241f4ec56f Reviewed-on: https://gerrit.libreoffice.org/78139 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/com/sun/star/uno/Sequence.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h
index 78d1124ba504..2ba8c71f8be8 100644
--- a/include/com/sun/star/uno/Sequence.h
+++ b/include/com/sun/star/uno/Sequence.h
@@ -27,6 +27,7 @@
#include <new>
#if defined LIBO_INTERNAL_ONLY
+#include <cassert>
#include <initializer_list>
#endif
@@ -151,6 +152,15 @@ public:
bool SAL_CALL hasElements() const
{ return (_pSequence->nElements > 0); }
+#if defined LIBO_INTERNAL_ONLY
+ /** This function allows to use Sequence in cases where std::size is needed, and the like.
+
+ @since LibreOffice 6.4
+ */
+ sal_uInt32 size() const
+ { assert(getLength() >= 0); return static_cast<sal_uInt32>(getLength()); }
+#endif
+
/** Gets a pointer to elements array for reading.
If the sequence has a length of 0, then the returned pointer is
undefined.
@@ -272,16 +282,6 @@ inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
}
}
-#if defined LIBO_INTERNAL_ONLY
-namespace std
-{
-template <class E> sal_Int32 size(const ::com::sun::star::uno::Sequence<E>& s)
-{
- return s.getLength();
-}
-}
-#endif
-
/** Gets the meta type of IDL sequence.
There are cases (involving templates) where uses of getCppuType are known to