#ifndef WORK_LIST_H_INCLUDED
#define WORK_LIST_H_INCLUDED

#include <vector>
#include <memory>

class UpdateCommand;
class WorkList {
public:
    std::vector<std::unique_ptr<UpdateCommand>> m_workList;
    unsigned m_workListIndex{0};

    WorkList() = default;

    template<typename T>
    void push_back(T&& arg) {
        m_workList.push_back(std::forward<T>(arg));
    }

    bool empty() const { return m_workList.empty(); }

    // move constructor: pass in classes derived from UpdateCommand
    // template<typename... Ts>
             //typename = typename std::enable_if<std::is_same<typename std::decay<Ts...>::type,
             //                                   UpdateCommand>::value>::type>
    // WorkList(Ts&&... args)
    //  : m_workList(std::forward<Ts...>(args...))
    //  , m_workListIndex(0) {
    //}

    unsigned nextExecIndex() const;
    bool nextExec() const;
    bool exec(bool last=false);
};

#endif // WORK_LIST_H_INCLUDED