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.
|
||
|---|---|---|
| debian | ||
| doc | ||
| etc | ||
| indra | ||
| scripts | ||
| .clang-format | ||
| .gitignore | ||
| .hgtags | ||
| BuildParams | ||
| README.md | ||
| autobuild.xml | ||
| build.sh | ||
README.md
Second Life Viewer
This project manages the source code for the Second Life Viewer.
This source is available as open source; for details on licensing, see the licensing page on the Second Life wiki
For information on how to use and contribute to this, see the open source portal on the wiki.
To download the current default version, visit the download page. For even newer versions try the Alternate Viewers page