From 1afef03c6d32b3f6eb0aa70155e4e6194d91bea2 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 19 Jun 2014 19:52:32 +0100 Subject: [PATCH] refs #210 workaround an apparent bug in 64bit MSVC by using a signed type for tuple flags (using a smaller unsigned type also worked) --- src/blackmisc/tuple.h | 12 ++++++------ src/blackmisc/tuple_private.h | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/blackmisc/tuple.h b/src/blackmisc/tuple.h index a263366da..5fa40a2bf 100644 --- a/src/blackmisc/tuple.h +++ b/src/blackmisc/tuple.h @@ -162,8 +162,8 @@ namespace BlackMisc protected: //! \brief A shorthand alias for passing flags as a compile-time constant. - template - using flags = std::integral_constant; + template + using flags = std::integral_constant; //! \brief Create a tuple element with default metadata. template @@ -174,8 +174,8 @@ namespace BlackMisc //! \brief Create a tuple element with attached metadata. //! @{ - template - static Private::Attribute attr(T &obj, std::integral_constant) + template + static Private::Attribute attr(T &obj, std::integral_constant) { return { obj }; } @@ -184,8 +184,8 @@ namespace BlackMisc { return { obj, jsonName }; } - template - static Private::Attribute attr(T &obj, QString jsonName, std::integral_constant) + template + static Private::Attribute attr(T &obj, QString jsonName, std::integral_constant) { return { obj, jsonName }; } diff --git a/src/blackmisc/tuple_private.h b/src/blackmisc/tuple_private.h index 115c9d986..b943eadbe 100644 --- a/src/blackmisc/tuple_private.h +++ b/src/blackmisc/tuple_private.h @@ -104,14 +104,14 @@ namespace BlackMisc using make_index_sequence_if = typename GenSequenceOnPredicate::value>::type; // Predicates used with make_index_sequence_if. - template + template struct FlagPresent { typedef Tu tuple_type; template struct test : std::integral_constant::type::flags & F)> {}; }; - template + template struct FlagMissing { typedef Tu tuple_type; @@ -120,23 +120,23 @@ namespace BlackMisc }; // Combine make_index_sequence_if with predicates to get the indices of tuple elements with certain flags. - template + template auto findFlaggedIndices(Tu &&) -> make_index_sequence_if::type>> { return {}; } - template + template auto skipFlaggedIndices(Tu &&) -> make_index_sequence_if::type>> { return {}; } // A tuple element with attached metadata. - template + template struct Attribute { typedef T type; - static const quint64 flags = Flags; + static const qint64 flags = Flags; Attribute(T &obj, QString jsonName = {}) : m_obj(obj), m_jsonName(jsonName) {} void extend(QString jsonName) { if (m_jsonName.isEmpty()) m_jsonName = jsonName; } @@ -160,7 +160,7 @@ namespace BlackMisc { return obj; } - template + template std::reference_wrapper tieHelper(Attribute attr) { return attr.m_obj; @@ -170,7 +170,7 @@ namespace BlackMisc { return obj; } - template + template Attribute tieMetaHelper(Attribute attr) { return attr; @@ -179,7 +179,7 @@ namespace BlackMisc // Compile-time assert for functions which require a meta tuple template struct assertMeta { static_assert(std::is_void::value, "Function expected a meta tuple, got a value tuple"); }; - template + template struct assertMeta...>> {}; // Convert a meta tuple to a value tuple