Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Text ui to expect references of std:string instead of a copy #14

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

caiotava
Copy link
Contributor

These changes aim to avoid generating two copies of the std::string when the classes' clients use the methods like setText:

// This way the function will receive the parameter by copy
void setFont(std::string font);
// Receives the string by reference without creating a new copy
void setFont(const std::string &font);

Let me know your thoughts, and I can replicate the same change throughout the project.

These changes aim to avoid generating two copies of the std::string when
the classes' clients use the methods like setText:

```cpp
// This way the function will receive the parameter by copy
void setFont(std::string font);
```

```cpp
// Receives the string by reference without creating a new copy
void setFont(const std::string &font);
```
@eduardodoria
Copy link
Contributor

I think for modern compilers it makes no difference. But always a good practice.
Ofcourse, you can replicate throughout the project.

Thanks

@eduardodoria eduardodoria merged commit d398870 into supernovaengine:main Dec 16, 2024
12 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