[Libreoffice-commits] core.git: include/com

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Dec 8 22:27:40 UTC 2018


 include/com/sun/star/uno/Sequence.hxx |   21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

New commits:
commit b297193296e6afd0a6045ab7cd9daf2374b3fb3a
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Dec 8 18:09:58 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Dec 8 23:27:19 2018 +0100

    Use constexpr if
    
    Change-Id: I7c34dfb5a83b14afc740772cffe407d4773b07e5
    Reviewed-on: https://gerrit.libreoffice.org/64818
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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;
 }
 


More information about the Libreoffice-commits mailing list