Skip to content

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.

3 participants