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

few cosmetic changes and with C++17 no need to explictly define copy … #607

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

devnexen
Copy link
Contributor

@devnexen devnexen commented Aug 9, 2022

…constructors.

OggStream::OggStream(const std::string &fname) {
_file = fopen(fname.c_str(), "rb");
OggStream::OggStream(const std::string_view fname) {
_file = fopen(fname.data(), "rb");
Copy link
Contributor

@caiiiycuk caiiiycuk Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why data is more preferable then c_str()?

Copy link
Contributor Author

@devnexen devnexen Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply because there is no such things with string_view :-) it s chunk of bytes that s how it gains perf over a traditional std string, no need allocation.

https://en.cppreference.com/w/cpp/string/basic_string_view

@stalkerg
Copy link
Contributor

Firstly I should migrate it to flatpack for steam, before we can use C++17.

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.

None yet

3 participants