include/com/sun/star/uno/Sequence.h | 10 ++++++++++ include/comphelper/sequence.hxx | 7 +++---- 2 files changed, 13 insertions(+), 4 deletions(-)
New commits: commit 8fc9c698ee643dd4363c5ad1daa7bbc0a13982d5 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Aug 26 01:26:34 2019 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Aug 26 07:25:18 2019 +0200 Generalize comphelper::concatSequences to accept other container types ... as second and following arguments. Change-Id: I1c994ec234354805bc702632878fd67a54d271d6 Reviewed-on: https://gerrit.libreoffice.org/78092 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h index f5c9c384eeef..78d1124ba504 100644 --- a/include/com/sun/star/uno/Sequence.h +++ b/include/com/sun/star/uno/Sequence.h @@ -272,6 +272,16 @@ 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 diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index 6c51311daf29..18e269173627 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -49,10 +49,9 @@ namespace comphelper inline css::uno::Sequence<T> concatSequences(const css::uno::Sequence<T>& rS1, const Ss&... rSn) { // unary fold to disallow empty parameter pack: at least have one sequence in rSn - css::uno::Sequence<T> aReturn(rS1.getLength() + (... + rSn.getLength())); - T* pReturn; - ((pReturn = std::copy_n(rS1.getConstArray(), rS1.getLength(), aReturn.getArray())), ..., - (pReturn = std::copy_n(rSn.getConstArray(), rSn.getLength(), pReturn))); + css::uno::Sequence<T> aReturn(std::size(rS1) + (... + std::size(rSn))); + T* pReturn = std::copy(std::begin(rS1), std::end(rS1), aReturn.begin()); + (..., (pReturn = std::copy(std::begin(rSn), std::end(rSn), pReturn))); return aReturn; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits