# HG changeset patch # User PeterN # Date 2019-03-02 08:06:02 # Node ID ca293b1be7a05d9b8126627fe49be059545b2b7c # Parent 0c3700217218a8208ab4ee431bdcc1ef19c9b6d5 Codechange: Make std::stack use std::vector container in string formatting/drawing. (#7305) This is a very minor performance increase which can add up during operations such as sorting. Performance impact my be platform/compiler dependent. diff --git a/src/gfx_layout.h b/src/gfx_layout.h --- a/src/gfx_layout.h +++ b/src/gfx_layout.h @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef WITH_ICU_LAYOUT #include "layout/ParagraphLayout.h" @@ -35,7 +36,7 @@ struct FontState { FontSize fontsize; ///< Current font size. TextColour cur_colour; ///< Current text colour. - std::stack colour_stack; ///< Stack of colours to assist with colour switching. + std::stack> colour_stack; ///< Stack of colours to assist with colour switching. FontState() : fontsize(FS_END), cur_colour(TC_INVALID) {} FontState(TextColour colour, FontSize fontsize) : fontsize(fontsize), cur_colour(colour) {} diff --git a/src/strings.cpp b/src/strings.cpp --- a/src/strings.cpp +++ b/src/strings.cpp @@ -791,7 +791,7 @@ static char *FormatString(char *buff, co WChar b = '\0'; uint next_substr_case_index = 0; char *buf_start = buff; - std::stack str_stack; + std::stack> str_stack; str_stack.push(str_arg); for (;;) {