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:
Mathew Sutcliffe
2014-03-23 21:08:58 +00:00
parent 6cf5089b18
commit 1dfb406d54
2 changed files with 139 additions and 22 deletions

View File

@@ -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