mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
Replaced std::tie with BlackMisc::tie, to help workaround tuples with more than 10 members.
This required some changes to the signatures of compare, qHash, and stream operators. refs #182
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <QString>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <functional>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -77,6 +78,29 @@ namespace BlackMisc
|
||||
}
|
||||
//! @}
|
||||
|
||||
// Helper which returns a copy of its argument if it's a tuple,
|
||||
// otherwise returns a reference to its argument.
|
||||
//! \private
|
||||
//! @{
|
||||
template <class T>
|
||||
auto tieHelper(T &obj, std::false_type isTupleTag) -> std::reference_wrapper<T>
|
||||
{
|
||||
Q_UNUSED(isTupleTag);
|
||||
return obj;
|
||||
}
|
||||
template <class T>
|
||||
auto tieHelper(T &obj, std::true_type isTupleTag) -> T
|
||||
{
|
||||
Q_UNUSED(isTupleTag);
|
||||
return obj;
|
||||
}
|
||||
template <class T>
|
||||
auto tieHelper(T &obj) -> decltype(tieHelper(obj, IsTuple<T>()))
|
||||
{
|
||||
return tieHelper(obj, IsTuple<T>());
|
||||
}
|
||||
//! @}
|
||||
|
||||
#ifdef Q_COMPILER_VARIADIC_TEMPLATES
|
||||
|
||||
// Applying operations to all elements in a tuple, using recursion
|
||||
|
||||
Reference in New Issue
Block a user