We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For example:
const std::vector<uint8_t> &BlaBla::toBuffer() const { return data_; }
If we use it to make BlaBla and get std::vector<uint8_t> from that and that all.
std::vector<uint8_t> vec = BlaBla().toBuffer(); // <= copy here
Will be better to use ref-qualifier to move data from sigle-used temp object:
const std::vector<uint8_t> &BlaBla::toBuffer() const & { // <= method for case of usual object return data_; } std::vector<uint8_t> BlaBla::toBuffer() const && { // <= method for case of temp object return std::move(data_); } std::vector<uint8_t> &BlaBla::asBuffer() { // <= method to access internal vector return data_; } const std::vector<uint8_t> &BlaBla::asBuffer() const { // <= method to RO-access internal vector return data_; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
For example:
If we use it to make BlaBla and get std::vector<uint8_t> from that and that all.
Will be better to use ref-qualifier to move data from sigle-used temp object:
The text was updated successfully, but these errors were encountered: