18 #ifndef sitkMemberFunctionFactoryBase_h
19 #define sitkMemberFunctionFactoryBase_h
27 #include "Ancillary/TypeList.h"
28 #include "Ancillary/FunctionTraits.h"
30 #include <unordered_map>
44 template <
typename T>
struct hash :
public std::hash<T>{};
54 seed ^= hasher(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
57 template<
typename S,
typename T>
58 struct hash<std::pair<S, T>>
60 inline size_t operator()(
const std::pair<S, T>& val)
const
69 template<
class... TupleArgs>
70 struct hash<std::tuple<TupleArgs...>>
75 template<
size_t Idx,
typename... TupleTypes>
76 inline typename std::enable_if<Idx ==
sizeof...(TupleTypes),
void>::type
79 template<
size_t Idx,
typename... TupleTypes>
80 inline typename std::enable_if<Idx <
sizeof...(TupleTypes),
void>::type
81 hash_combine_tup(
size_t& seed,
const std::tuple<TupleTypes...>& tup)
const
86 hash_combine_tup<Idx+1>(seed, tup);
90 size_t operator()(std::tuple<TupleArgs...> tupleValue)
const
93 hash_combine_tup<0>(seed, tupleValue);
99 template<
typename TMemberFunctionPointer,
101 unsigned int TArity = ::detail::FunctionTraits<TMemberFunctionPointer>::arity>
111 template<
typename TMemberFunctionPo
inter,
typename TKey>
118 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
147 return std::bind( pfunc,objectPointer );
165 template<
typename TMemberFunctionPo
inter,
typename TKey>
172 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
199 using namespace std::placeholders;
204 return std::bind( pfunc,objectPointer, _1 );
216 template<
typename TMemberFunctionPo
inter,
typename TKey>
226 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
252 using namespace std::placeholders;
257 return std::bind( pfunc, objectPointer, _1, _2 );
268 template<
typename TMemberFunctionPo
inter,
typename TKey>
279 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
304 using namespace std::placeholders;
309 return std::bind( pfunc, objectPointer, _1, _2, _3 );
320 template<
typename TMemberFunctionPo
inter,
typename TKey>
332 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
357 using namespace std::placeholders;
362 return std::bind( pfunc, objectPointer, _1, _2, _3, _4 );
372 template<
typename TMemberFunctionPo
inter,
typename TKey>
385 using ObjectType = typename ::detail::FunctionTraits<MemberFunctionType>::ClassType;
396 typedef std::function< MemberFunctionResultType (
397 MemberFunctionArgument0Type,
398 MemberFunctionArgument1Type,
399 MemberFunctionArgument2Type,
400 MemberFunctionArgument3Type,
401 MemberFunctionArgument4Type ) >
416 using namespace std::placeholders;
421 return std::bind( pfunc, objectPointer, _1, _2, _3, _4, _5 );
437 #endif // sitkMemberFunctionFactoryBase_h