#pragma once // system includes #include #include #include namespace cpputils { template class Signal { public: using Slot = std::function; Signal &operator+=(Slot &&slot) { m_slots.emplace_back(std::move(slot)); return *this; } Signal &operator+=(const Slot &slot) { m_slots.emplace_back(slot); return *this; } template void operator()(Targs && ...args) const { for (const auto &slot : m_slots) slot(std::forward(args)...); } private: std::vector m_slots; }; } // namespace cpputils