QDataStream: code tidies

As spotted in the code review, remove_cv here is useless. Since T is
passed by value, template type deduction will strip cv-ref for us.

(Also: in general we don't support users specifying template type
parameters except where authorized, but here they can't, as this is an
operator.)

Amends 3823e310e39426043dc7f0529a6fba33fe4d49f0

Change-Id: I5b5db38a4dcf4f1179d748cf0bb1b62a9896f5a6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2024-02-23 15:29:21 +01:00
parent 1556a3a5eb
commit 4d55feb743

View File

@ -173,7 +173,7 @@ public:
#if !defined(Q_QDOC)
// Disable implicit conversions to bool (e.g. for pointers)
template <typename T,
std::enable_if_t<std::is_same_v<std::remove_cv_t<T>, bool>, bool> = true>
std::enable_if_t<std::is_same_v<T, bool>, bool> = true>
QDataStream &operator<<(T i)
{
return (*this << qint8(i));