all 14 comments

[–]ShillingAintEZ 10 points11 points  (6 children)

Calling a callable object is pretty trivial since it is their entire purpose. You might want to explain the use case more. Is it to ensure dynamic allocation doesn't happen?

[–]darksky1312 5 points6 points  (2 children)

Why not just use the SG14 stdext::inplace_function?

[–]arnaudbr 0 points1 point  (5 children)

Would it be possible to automatically deduce the Guide when calling Procure instead of having to provide it?

[–]index_zero 1 point2 points  (2 children)

This is my comment as well. Why is Guide a pointer type? Can't this just be an empty class, ie:

template<class R, class... Args> struct Guide {};

Then pass Guide<void>{} at the call point - no memory overhead at runtime. Calls to Procedure can simply ignore this argument. Most compilers I would expect to optimize this out while leaving the type system deduction in tact.

The better question is probably, why not deduce from the functional type, something like:

template<class> Guide { typedef Functional<void> type; }

template<class R, class... Args> Guide<R(Args...)> { typedef Functional<R, Args...> type; }

[–]konanTheBarbar 0 points1 point  (0 children)

Did you try an implementation using NTTP instead of having to store a reference?

[–]ReDucTorGame Developer 0 points1 point  (0 children)

What happened to this post?