В основном я хочу иметь возможность добавлять аргументы как вариации, как константная ссылка, так и семантика перемещения, но если их необходимо сохранить как кортежи, то нет причин не разрешать передачу и готовых кортежей...
Вот что у меня сейчас есть:
Код: Выделить всё
#include
using std::cout;
using std::endl;
#include
#include
#include // pair
#include
#include
template
class Executor
{
public:
using ArgTpl = std::tuple;
using Function = std::function;
typedef Ret(*FunctionPtr)(Args...);
private:
using Future = std::future;
using Promise = std::promise;
using Task = std::pair;
const Function callback;
std::queue task_queue;
public:
Executor(Function f) : callback(f) {}
Executor(FunctionPtr fp) : Executor(static_cast(fp)) {}
~Executor() {}
//
Future push(const Args&... args)// requires (sizeof...(args) != 0)
{
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78312567/overloading-method-for-accepting-tuple-and-variadic-both-const-ref-and-move[/url]
Мобильная версия