From 2eccbbbe6fe2589f9133b7e5702832e21b26e8cf Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 17 Sep 2019 19:06:49 +1000 Subject: Avoid unnecessary allocations in NCursesUI::Window::draw calls Pass an ArrayView instead of a DisplayLine& so that the newly common case of passing a single atom does not require constructing a Vector. --- src/display_buffer.hh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/display_buffer.hh') diff --git a/src/display_buffer.hh b/src/display_buffer.hh index 045a1cc8..1c8fc53d 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -30,6 +30,9 @@ public: DisplayAtom(String str, Face face) : face(face), m_type(Text), m_text(std::move(str)) {} + explicit DisplayAtom(String str) + : DisplayAtom(std::move(str), Face{}) {} + StringView content() const; ColumnCount length() const; -- cgit v1.2.3