From 911c74d0ec05a2b216936e3f58900a4aea137146 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 23 Oct 2021 19:43:31 +0200 Subject: Use std::size/begin/end in comphelper::containerToSequence This allows e.g. to use the function with valarrays, that don't have own begin/end, but has std::begin/end overloads. Change-Id: I4559180e30040ed5d42805170a02a53280fce9ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124015 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- include/comphelper/sequence.hxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index 7c999ec25059..d446894574e5 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -181,8 +181,8 @@ namespace comphelper template < typename DstElementType, typename SrcType > inline css::uno::Sequence< DstElementType > containerToSequence( const SrcType& i_Container ) { - css::uno::Sequence< DstElementType > result( i_Container.size() ); - ::std::copy( i_Container.begin(), i_Container.end(), result.getArray() ); + css::uno::Sequence< DstElementType > result( ::std::size(i_Container) ); + ::std::copy( ::std::begin(i_Container), ::std::end(i_Container), result.getArray() ); return result; } @@ -190,9 +190,7 @@ namespace comphelper template < typename SrcType > inline css::uno::Sequence< typename SrcType::value_type > containerToSequence( const SrcType& i_Container ) { - css::uno::Sequence< typename SrcType::value_type > result( i_Container.size() ); - ::std::copy( i_Container.begin(), i_Container.end(), result.getArray() ); - return result; + return containerToSequence(i_Container); } // handle arrays -- cgit