diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index a48a9ce9..47f9a88b 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -264,7 +264,7 @@ Buffer* create_fifo_buffer(String name, int fd, Buffer::Flags flags, bool scroll bool m_scroll; }; - buffer->values()[fifo_watcher_id] = Value(std::make_unique(fd, *buffer, scroll)); + buffer->values()[fifo_watcher_id] = Value(Meta::Type{}, fd, *buffer, scroll); buffer->flags() = flags | Buffer::Flags::Fifo | Buffer::Flags::NoUndo; buffer->run_hook_in_own_context(Hook::BufOpenFifo, buffer->name()); diff --git a/src/value.hh b/src/value.hh index 982cb912..2b9e0d22 100644 --- a/src/value.hh +++ b/src/value.hh @@ -3,6 +3,7 @@ #include "hash_map.hh" #include "units.hh" +#include "meta.hh" #include #include @@ -20,6 +21,10 @@ struct Value Value(T&& val) : m_value{new Model>{std::forward(val)}} {} + template + Value(Meta::Type, auto&&... args) : + m_value(new Model(std::forward(args)...)) {} + Value(const Value& val) = delete; Value(Value&&) = default; @@ -58,7 +63,7 @@ private: template struct Model : public Concept, public UseMemoryDomain { - Model(T&& val) : m_content(std::move(val)) {} + Model(auto&&... args) : m_content(std::forward(args)...) {} const std::type_info& type() const override { return typeid(T); } T m_content;