mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refs #245 TupleConverter specialization for class templates can use a variadic parameter pack to support templates taking any number of parameters
This commit is contained in:
@@ -79,16 +79,16 @@
|
|||||||
#define BLACK_DECLARE_TUPLE_CONVERSION_TEMPLATE(T, MEMBERS) \
|
#define BLACK_DECLARE_TUPLE_CONVERSION_TEMPLATE(T, MEMBERS) \
|
||||||
namespace BlackMisc \
|
namespace BlackMisc \
|
||||||
{ \
|
{ \
|
||||||
template <class U> class TupleConverter<T<U>> \
|
template <class... U> class TupleConverter<T<U...>> \
|
||||||
{ \
|
{ \
|
||||||
friend class T<U>; \
|
friend class T<U...>; \
|
||||||
static_assert(Private::HasEnabledTupleConversion<T<U>>::value, \
|
static_assert(Private::HasEnabledTupleConversion<T<U...>>::value, \
|
||||||
"Missing BLACK_ENABLE_TUPLE_CONVERSION macro in " #T); \
|
"Missing BLACK_ENABLE_TUPLE_CONVERSION macro in " #T); \
|
||||||
static auto toTuple(const T<U> &o) -> decltype(BlackMisc::tie MEMBERS) \
|
static auto toTuple(const T<U...> &o) -> decltype(BlackMisc::tie MEMBERS) \
|
||||||
{ \
|
{ \
|
||||||
return BlackMisc::tie MEMBERS; \
|
return BlackMisc::tie MEMBERS; \
|
||||||
} \
|
} \
|
||||||
static auto toTuple(T<U> &o) -> decltype(BlackMisc::tie MEMBERS) \
|
static auto toTuple(T<U...> &o) -> decltype(BlackMisc::tie MEMBERS) \
|
||||||
{ \
|
{ \
|
||||||
return BlackMisc::tie MEMBERS; \
|
return BlackMisc::tie MEMBERS; \
|
||||||
} \
|
} \
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
return members; \
|
return members; \
|
||||||
} \
|
} \
|
||||||
public: \
|
public: \
|
||||||
static auto constToTuple(const T<U> &o) -> decltype(BlackMisc::tie MEMBERS) \
|
static auto constToTuple(const T<U...> &o) -> decltype(BlackMisc::tie MEMBERS) \
|
||||||
{ \
|
{ \
|
||||||
return BlackMisc::tie MEMBERS; \
|
return BlackMisc::tie MEMBERS; \
|
||||||
} \
|
} \
|
||||||
|
|||||||
Reference in New Issue
Block a user