If I have a function with variable arguments, with one of them being a callback function, how would the bind function for that work? Current implementation as below:
template <typename... Args>
bool CallWithArgs(std::function<void (String&, Args... args)> cbk, Args... args)
{ .... }
The above function is being called from a separate class using a future:
bool value = true;
auto f1 = std::bind(&CallWithArgs, rawPtr, _1, _2);
std::future<bool> fut = std::async(f1, cbk, value);
fut.wait();
Is there anyway to represent variable parameters in the placeholders of the std::bind function? Running into compile issues with the present implementation.
note: template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__or_<std::is_integral<typename std::decay<_Tp>::type>, std::is_enum<typename std::decay<_Tp>::type> >::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...)
bind(_Func&& __f, _BoundArgs&&... __args)
note: template argument deduction/substitution failed:
note: couldn't deduce template parameter ‘_Func’
std::bind.