summaryrefslogtreecommitdiff
path: root/indra/llcommon/llcallstack.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2021-05-10 15:21:51 -0400
committerNat Goodspeed <nat@lindenlab.com>2021-05-10 15:21:51 -0400
commit95d8085fa42ca73773a06f2bd5622f69aef0e598 (patch)
tree2d8d6543ce378ed4c7bdbc007042b6148653e0d7 /indra/llcommon/llcallstack.h
parentce65bc2f13409d75dbc6502c970030cc5ed2e5ad (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/llcommon/llcallstack.h')
0 files changed, 0 insertions, 0 deletions