26 #ifndef AURORA_DISPATCHTRAITS_HPP 
   27 #define AURORA_DISPATCHTRAITS_HPP 
   46     std::type_index derefTypeid(T& reference)
 
   48         return typeid(reference);
 
   52     std::type_index derefTypeid(T* pointer)
 
   54         return typeid(*pointer);
 
   86     template <
typename UnusedId, 
typename Fn>
 
   94     template <
typename UnusedId1, 
typename UnusedId2, 
typename Fn>
 
  111 template <
typename S, std::
size_t N>
 
  117         typedef typename FunctionResult<S>::Type R;
 
  118         typedef typename FunctionParam<S, 0>::Type B;
 
  119         typedef typename FunctionParam<S, N>::Type U;
 
  121         static_assert(std::is_polymorphic<
typename std::remove_pointer<
typename std::remove_reference<B>::type>::type>::value,
 
  122             "B must be a pointer or reference to a polymorphic base class.");
 
  130         typedef std::type_index 
Key;
 
  136             return detail::derefTypeid(m);
 
  141         template <
typename T>
 
  144             static_cast<void>(id); 
 
  150         template <
typename Id, 
typename Fn>
 
  158         template <
typename Id1, 
typename Id2, 
typename Fn>
 
  176         template <
typename Id, 
typename Fn>
 
  179             return [f] (B arg) 
mutable -> R
 
  181                 typedef AURORA_REPLICATE(B, 
typename Id::type) Derived;
 
  182                 return f(static_cast<Derived>(arg));
 
  187         template <typename Id, typename Fn>
 
  190             return [f] (B arg, U userData) 
mutable -> R
 
  192                 typedef AURORA_REPLICATE(B, 
typename Id::type) Derived;
 
  193                 return f(static_cast<Derived>(arg), userData);
 
  198         template <typename Id1, typename Id2, typename Fn>
 
  201             return [f] (B arg1, B arg2) 
mutable -> R
 
  203                 typedef AURORA_REPLICATE(B, 
typename Id1::type) Derived1;
 
  204                 typedef AURORA_REPLICATE(B, typename Id2::type) Derived2;
 
  205                 return f(static_cast<Derived1>(arg1), static_cast<Derived2>(arg2));
 
  210         template <typename Id1, typename Id2, typename Fn>
 
  213             return [f] (B arg1, B arg2, U userData) 
mutable -> R
 
  215                 typedef AURORA_REPLICATE(B, 
typename Id1::type) Derived1;
 
  216                 typedef AURORA_REPLICATE(B, typename Id2::type) Derived2;
 
  217                 return f(static_cast<Derived1>(arg1), static_cast<Derived2>(arg2), userData);
 
  227 template <typename R, 
unsigned int N>
 
  234 template <
typename R>
 
  237     R operator() ()
 const 
  243 template <
typename R>
 
  246     template <
typename T1>
 
  247     R operator() (
const T1&)
 const 
  253 template <
typename R>
 
  256     template <
typename T1, 
typename T2>
 
  257     R operator() (
const T1&, 
const T2&)
 const 
  265 #endif // AURORA_DISPATCHTRAITS_HPP 
Utilities for template metaprogramming. 
 
Functor doing nothing. 
Definition: DispatchTraits.hpp:228
 
static Fn trampoline2(Fn f)
Maps a function to itself (no trampoline needed) 
Definition: DispatchTraits.hpp:95
 
Simple type wrapper, can be used for overload resolution. 
Definition: Templates.hpp:120
 
static const char * name(Key)
Returns a string representation of the key, for debugging. 
Definition: DispatchTraits.hpp:102
 
static Key keyFromId(Type< T > id)
Function that takes static type information and returns a type-erased std::type_index object...
Definition: DispatchTraits.hpp:142
 
Configuration header of the library. 
 
Simple integer wrapper, can be used for overload resolution. 
Definition: Templates.hpp:128
 
K Key
Key to differentiate objects. 
Definition: DispatchTraits.hpp:75
 
static Key keyFromBase(B m)
Function that takes an object to identify and returns the corresponding std::type_index object...
Definition: DispatchTraits.hpp:134
 
Identifies a class using RTTI. 
Definition: DispatchTraits.hpp:112
 
static std::function< S > trampoline1(Fn f)
Wraps a function such that the argument is downcast before being passed. 
Definition: DispatchTraits.hpp:151
 
static Fn trampoline1(Fn f)
Maps a function to itself (no trampoline needed) 
Definition: DispatchTraits.hpp:87
 
static const Key & keyFromId(const Key &k)
Maps a key to itself (assuming key and type identifier are the same) 
Definition: DispatchTraits.hpp:79
 
static std::function< S > trampoline2(Fn f)
Wraps a function such that both arguments are downcast before being passed. 
Definition: DispatchTraits.hpp:159
 
std::type_index Key
Key type. 
Definition: DispatchTraits.hpp:122
 
Helper base class to implement custom traits for dispatchers. 
Definition: DispatchTraits.hpp:71
 
static const char * name(Key k)
Returns a string representation of the key, for debugging. 
Definition: DispatchTraits.hpp:166
 
Definition: DispatchTraits.hpp:39