diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-12-08 18:09:58 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-12-08 23:27:19 +0100 |
commit | b297193296e6afd0a6045ab7cd9daf2374b3fb3a (patch) | |
tree | 682625d6d61595c76410070c14624bd1c212d349 /include/com/sun/star | |
parent | 777a3f0a157402b249789e19a6fd5750c44ca971 (diff) |
Use constexpr if
Change-Id: I7c34dfb5a83b14afc740772cffe407d4773b07e5
Reviewed-on: https://gerrit.libreoffice.org/64818
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/com/sun/star')
-rw-r--r-- | include/com/sun/star/uno/Sequence.hxx | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx index 64f84ffc7bc3..33014a81a4fd 100644 --- a/include/com/sun/star/uno/Sequence.hxx +++ b/include/com/sun/star/uno/Sequence.hxx @@ -245,9 +245,6 @@ void sequence_output_bytes( std::basic_ostream<charT, traits> &os, const value_t os.setf(flags); } -template<class B> -struct negation : std::integral_constant<bool, !bool(B::value)> { }; - } /** @@ -257,21 +254,15 @@ struct negation : std::integral_constant<bool, !bool(B::value)> { }; @since LibreOffice 6.1 */ template< typename value_t, typename charT, typename traits > -inline typename std::enable_if<uno_detail::negation<std::is_same<sal_Int8, value_t>>::value, std::basic_ostream<charT, traits>>::type &operator<<(std::basic_ostream<charT, traits> &os, css::uno::Sequence < value_t > &v) +inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &os, css::uno::Sequence < value_t > &v) { const value_t *pAry = v.getConstArray(); sal_Int32 nLen = v.getLength(); - uno_detail::sequence_output_elems(os, pAry, nLen, std::is_integral<value_t>()); - return os; -} - -template< typename value_t, typename charT, typename traits > -inline typename std::enable_if<std::is_same<sal_Int8, value_t>::value, std::basic_ostream<charT, traits>>::type &operator<<(std::basic_ostream<charT, traits> &os, css::uno::Sequence < value_t > &v) -{ - // specialisation for signed bytes - const sal_Int8 *pAry = v.getConstArray(); - sal_Int32 nLen = v.getLength(); - uno_detail::sequence_output_bytes(os, pAry, nLen); + if constexpr (std::is_same<sal_Int8, value_t>::value) { + uno_detail::sequence_output_bytes(os, pAry, nLen); + } else { + uno_detail::sequence_output_elems(os, pAry, nLen, std::is_integral<value_t>()); + } return os; } |