https://gcc.gnu.org/g:2633f491aedadd71ac44f5294c0035a95a35bdfd

commit r17-4906-g2633f491aedadd71ac44f5294c0035a95a35bdfd
Author: linden <[email protected]>
Date:   Sat Sep 26 18:41:53 2026 +1200

    text-art: add array2::set overload taking an rvalue element
    
    array2::set only took a const reference, so a std::move at the call site, 
as in canvas::paint, still copy-assigned. Add an overload that move-assigns, so 
the std::move takes effect for element types that own a std::vector, such as 
styled_unichar.
    
    gcc/ChangeLog:
    
            * text-art/types.h (text_art::array2::set): Add overload taking
            element_t &&.
    
    Signed-off-by: linden <[email protected]>

Diff:
---
 gcc/text-art/types.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/text-art/types.h b/gcc/text-art/types.h
index 8778bb1a13d7..a31184146129 100644
--- a/gcc/text-art/types.h
+++ b/gcc/text-art/types.h
@@ -183,6 +183,12 @@ class array2
     m_elements[idx] = element;
   }
 
+  void set (const coord_t &coord, element_t &&element)
+  {
+    ::size_t idx = get_idx (coord);
+    m_elements[idx] = std::move (element);
+  }
+
   void fill (element_t element)
   {
     for (int y = 0; y < m_size.h; y++)

Reply via email to