QTest: simplify toString(tuple)
Use C++14's std::index_sequence instead of our home-brewed QtPrivate::IndexList. I used make_index_sequence<sizeof...(Types)> instead of index_sequence_for<Types...> to avoid having to resolve another type-dependent template alias. Remove the helper's vacuous \internal qdoc block. As a drive-by, rename the helper function to prevent it from participating in QTest::toString() overload resolution, and fix spaces around &. Pick-to: 6.6 6.5 Change-Id: I5981a9b1a99fbe741e75820a6954d066ced9573d Reviewed-by: Jason McDonald <macadder1@gmail.com>bb10
parent
d42b901ae4
commit
ba44a71406
|
|
@ -377,8 +377,8 @@ inline char *toString(const std::pair<T1, T2> &pair)
|
|||
return formatString("std::pair(", ")", 2, first.data(), second.data());
|
||||
}
|
||||
|
||||
template <typename Tuple, int... I>
|
||||
inline char *toString(const Tuple & tuple, QtPrivate::IndexesList<I...>) {
|
||||
template <typename Tuple, std::size_t... I>
|
||||
inline char *tupleToString(const Tuple &tuple, std::index_sequence<I...>) {
|
||||
using UP = std::unique_ptr<char[]>;
|
||||
// Generate a table of N + 1 elements where N is the number of
|
||||
// elements in the tuple.
|
||||
|
|
@ -392,8 +392,7 @@ inline char *toString(const Tuple & tuple, QtPrivate::IndexesList<I...>) {
|
|||
template <class... Types>
|
||||
inline char *toString(const std::tuple<Types...> &tuple)
|
||||
{
|
||||
static const std::size_t params_count = sizeof...(Types);
|
||||
return toString(tuple, typename QtPrivate::Indexes<params_count>::Value());
|
||||
return tupleToString(tuple, std::make_index_sequence<sizeof...(Types)>{});
|
||||
}
|
||||
|
||||
inline char *toString(std::nullptr_t)
|
||||
|
|
|
|||
|
|
@ -1622,12 +1622,6 @@
|
|||
Returns a textual representation of the key sequence \a ks.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn template <typename Tuple, int... I> char *QTest::toString(const Tuple &tuple, QtPrivate::IndexesList<I...> )
|
||||
\internal
|
||||
\since 5.12
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPointingDevice * QTest::createTouchDevice(QInputDevice::DeviceType devType = QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps = QInputDevice::Capability::Position)
|
||||
\since 5.8
|
||||
|
|
|
|||
Loading…
Reference in New Issue