signal: add forwarding value_signal constructor

This commit is contained in:
Danny Robson 2015-02-20 15:27:18 +11:00
parent ba878238af
commit 0f9e0fe5a7
2 changed files with 11 additions and 0 deletions

View File

@ -64,6 +64,9 @@ namespace util {
template <typename T> template <typename T>
class value_signal : public signal<void(T)> { class value_signal : public signal<void(T)> {
public: public:
value_signal (T&&);
value_signal () = default;
operator const T&() const; operator const T&() const;
value_signal<T>& operator= (const T&); value_signal<T>& operator= (const T&);

View File

@ -171,12 +171,20 @@ namespace util {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
template <typename T> template <typename T>
value_signal<T>::value_signal (T &&t):
m_value (std::forward<T> (t))
{ ; }
//-------------------------------------------------------------------------
template <typename T>
value_signal<T>::operator const T&() const value_signal<T>::operator const T&() const
{ {
return m_value; return m_value;
} }
//-------------------------------------------------------------------------
template <typename T> template <typename T>
value_signal<T>& value_signal<T>&
value_signal<T>::operator= (const T &t) value_signal<T>::operator= (const T &t)