Skip to content

Some random patches#375

Merged
texus merged 5 commits into
texus:1.xfrom
jjuhl:some-random-patches
May 29, 2026
Merged

Some random patches#375
texus merged 5 commits into
texus:1.xfrom
jjuhl:some-random-patches

Conversation

@jjuhl
Copy link
Copy Markdown
Contributor

@jjuhl jjuhl commented May 29, 2026

No description provided.

jjuhl added 4 commits May 29, 2026 17:34
The code only performs sequential iteration and does not require stable
iterators or constant-time insert/erase in the middle of the sequence.

std::vector provides contiguous storage, better cache locality, and
avoids the per-node allocation overhead associated with std::list.
Let's try to be consistent.
@texus
Copy link
Copy Markdown
Owner

texus commented May 29, 2026

Replace std::list with std::vector in Layout constructor

On first sight it does look like you are correct and std::vector can be used here as the erase calls seem to happen on elements BEHIND the iterator that is kept. However maybe you can also get rid of the std::advance usages?

For example

auto nextOperandIt = operandIt;
std::advance(nextOperandIt, 1);

looks like it could just be the following now:

const auto nextOperandIt = operandIt + 1;

std::advance was only used because std::list was used.

Simplify CSS

The max-width: 100%; probably needs to stay. This custom.css file exists to make the generated code compatible with the website. And on the website the max-width of body is altered (https://github.com/texus/TGUI-website/blob/master/resources/style.scss#L22).

@jjuhl
Copy link
Copy Markdown
Contributor Author

jjuhl commented May 29, 2026

Ok. I'll drop the max-width change.
As for the std::advance, I did think of that but chose to maybe make that a future commit since I couldn't convince myself that changing it would be 100% safe, so I just stuck to what I knew would be safe (and then more changes can maybe come later).

Add a missing semicolon and simplify padding expression.
@jjuhl jjuhl force-pushed the some-random-patches branch from 8ccc438 to 286e1d0 Compare May 29, 2026 18:40
@jjuhl
Copy link
Copy Markdown
Contributor Author

jjuhl commented May 29, 2026

Dropped the max-width change.
The other bits can maybe come in future commits. But thank you very much for pointing it out :-)

@texus texus merged commit 64892c3 into texus:1.x May 29, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants