diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2021-05-10 15:21:51 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2021-05-10 15:21:51 -0400 |
commit | 95d8085fa42ca73773a06f2bd5622f69aef0e598 (patch) | |
tree | 2d8d6543ce378ed4c7bdbc007042b6148653e0d7 /indra/newview/llfloaterbuy.h | |
parent | ce65bc2f13409d75dbc6502c970030cc5ed2e5ad (diff) |
SL-10297: Make LLSingletonBase::llerrs() et al. runtime variadic.
Instead of accepting a fixed list of (const char* p1="", etc.), accept
(std::initializer_list<std::string_view>). Accepting a
std::initializer_list<T> in your parameter list allows coding (e.g.)
func({T0, T1, T2, ... });
-- in other words, you can pass the initializer_list a brace-enclosed list of
an arbitrary number of instances of T.
Using std::string_view instead of const char* means we can pass *either* const
char* or std::string. string_view is cheaply constructed from either, allowing
uniform treatment within the function.
Constructing string_view from std::string simply extracts the pointer and
length from the std::string.
Constructing string_view from const char* (e.g. a "string literal") requires
scanning the string for its terminating nul byte -- but that would be
necessary even if the scan were deferred until the function body. Since
string_view stores the length, the scan still happens only once.
Diffstat (limited to 'indra/newview/llfloaterbuy.h')
0 files changed, 0 insertions, 0 deletions