boostorg / boost

Super-project for modularized Boost
https://github.com/boostorg/wiki/wiki/Getting-Started%3A-Overview
Boost Software License 1.0
6.97k stars 1.72k forks source link

Add [[nodiscard]] attribute to the boost::span::subspan #910

Open ujos opened 3 months ago

ujos commented 3 months ago

Could you add the [[nodiscard]] attribute to the boost::span::subspan function. I tend to forget to store the returned value:

buffer_.subspan(bytesTransferred);

... instead of

buffer_ = buffer_.subspan(bytesTransferred);