mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
d6995e311e
Passing T by const ref instead of by value. This is important specially to prevent perf implications when this class is used for heavy to copy objects. A common example would be shared_ptr. Another way to prevent two versions of the constructor is to have a single constructor and move the value. <code> not_null(T t) : ptr_(move(t)) {...} </code> This gives best of both worlds. For most cases I would have preferred this. But this can result in slightly bigger code since for the cases where this class is invoked from a copy of he object, the caller has to do the job of creating the copy. |
||
---|---|---|
.. | ||
array_view.h | ||
fail_fast.h | ||
gsl.h | ||
string_view.h |