mirror-chatterino2/src/common/SimpleSignalVector.hpp

35 lines
525 B
C++
Raw Normal View History

#pragma once
#include <pajlada/signals/signal.hpp>
#include <mutex>
#include <vector>
namespace chatterino {
template <typename TValue>
class SimpleSignalVector
{
public:
SimpleSignalVector &operator=(std::vector<TValue> &other)
{
this->data = other;
this->updated.invoke();
return *this;
}
operator std::vector<TValue> &()
{
return this->data;
}
pajlada::Signals::NoArgSignal updated;
private:
std::vector<TValue> data;
};
} // namespace chatterino