diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-09 10:57:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-10 06:52:26 +0000 |
commit | ee0e713b5333dd363e443bf471ecb5cecec09d17 (patch) | |
tree | 481a53fcbd72e822ad64d3c83309d1c0d6f5be75 /include | |
parent | 5c2c2d8dc4449c9d4ac9d645f634772ba93373af (diff) |
make comphelper::sequenceToContainer a little smarter
so we don't have to specify the source type
Change-Id: I4106705a39874a8043f0f294a11374404d6cfc3a
Reviewed-on: https://gerrit.libreoffice.org/30713
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/sequence.hxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index bb1b1e81ba61..68c361c6282f 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -340,6 +340,15 @@ namespace comphelper return result; } + // this one does better type deduction, but does not allow us to copy into a different element type + template < typename DstType > + inline DstType sequenceToContainer( const css::uno::Sequence< typename DstType::value_type >& i_Sequence ) + { + DstType result( i_Sequence.getLength() ); + ::std::copy( i_Sequence.begin(), i_Sequence.end(), result.begin() ); + return result; + } + /** Copy from a Sequence into an existing container This potentially saves a needless extra copy operation over |