summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-08 15:53:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-09 07:48:18 +0000
commit389999abdb2d35f8641a6ff2e8984887166d39e2 (patch)
tree746ae9503700b07bb84938c8899a24aeb8b8fcd8 /include/comphelper
parent57998f642de65bdcb72742abd8ab94a26840a31d (diff)
make comphelper::containerToSequence a little smarter
So we don't have to specify the source and destination type as often. Change-Id: Id9e286417a1cb246d163cbc3c536b231a4a92624 Reviewed-on: https://gerrit.libreoffice.org/30700 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/sequence.hxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
index 7d8209d7a21f..bb1b1e81ba61 100644
--- a/include/comphelper/sequence.hxx
+++ b/include/comphelper/sequence.hxx
@@ -291,6 +291,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 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;
+ }
+
template <typename T>
inline css::uno::Sequence<T> containerToSequence(
::std::vector<T> const& v )