Advertisement
coder0xff

Untitled

Sep 12th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. template<typename... TDone>
  2. class ParamUnpacker
  3. {
  4. public:
  5.     template<typename RetType, typename TNext, typename... TRest>
  6.     static RetType ExecuteFunction(TDone... done, std::list<Object::Ref> &rest, boost::function<RetType (TDone..., TNext, TRest...)> func)
  7.     {
  8.         TNext next = boost::dynamic_pointer_cast<TNext::value_type>(rest.pop_front());
  9.         return ParamUnpacker<TDone..., TNext>::template ExecuteFunction<RetType, TRest...>(done..., next, rest, func);
  10.     }
  11.    
  12.     template<typename RetType, typename TNext>
  13.     static RetType ExecuteFunction(TDone... done, std::list<Object::Ref> &rest, boost::function<RetType (TDone..., TNext)> func)
  14.     {
  15.         TNext next = boost::dynamic_pointer_cast<TNext::value_type>(rest.pop_front());
  16.         return func(done..., next);
  17.     }
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement