include/comphelper/sequence.hxx |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 911c74d0ec05a2b216936e3f58900a4aea137146
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Oct 23 19:43:31 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Oct 23 21:23:36 2021 +0200

    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 <mike.kagan...@collabora.com>

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<typename SrcType::value_type, 
SrcType>(i_Container);
     }
 
     // handle arrays

Reply via email to