Kaydet (Commit) b2971932 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use constexpr if

Change-Id: I7c34dfb5a83b14afc740772cffe407d4773b07e5
Reviewed-on: https://gerrit.libreoffice.org/64818
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 777a3f0a
...@@ -245,9 +245,6 @@ void sequence_output_bytes( std::basic_ostream<charT, traits> &os, const value_t ...@@ -245,9 +245,6 @@ void sequence_output_bytes( std::basic_ostream<charT, traits> &os, const value_t
os.setf(flags); 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)> { }; ...@@ -257,21 +254,15 @@ struct negation : std::integral_constant<bool, !bool(B::value)> { };
@since LibreOffice 6.1 @since LibreOffice 6.1
*/ */
template< typename value_t, typename charT, typename traits > 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(); const value_t *pAry = v.getConstArray();
sal_Int32 nLen = v.getLength(); sal_Int32 nLen = v.getLength();
uno_detail::sequence_output_elems(os, pAry, nLen, std::is_integral<value_t>()); if constexpr (std::is_same<sal_Int8, value_t>::value) {
return os; uno_detail::sequence_output_bytes(os, pAry, nLen);
} } else {
uno_detail::sequence_output_elems(os, pAry, nLen, std::is_integral<value_t>());
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);
return os; return os;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment