We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`template <class... P> static T &instance(P... args) { if (s_ins) { return *s_ins; }
std::call_once(s_once, [&]() { s_ins = new T(args...); }); return *s_ins; } static T &instance() { if (s_ins) { return *s_ins; } std::call_once(s_once, [&]() { s_ins = new T(); }); return *s_ins; }
`
单件写成这样应该编不过的吧?估计得写成宏才能支持多种参数的情况吧,或者能把参数保存下来么?第一次使用完整的参数,后面使用保存下来的参数?
The text was updated successfully, but these errors were encountered:
use std::tuple and std::apply or add init method to singleton class
Sorry, something went wrong.
No branches or pull requests
`template <class... P>
static T &instance(P... args)
{
if (s_ins)
{
return *s_ins;
}
`
单件写成这样应该编不过的吧?估计得写成宏才能支持多种参数的情况吧,或者能把参数保存下来么?第一次使用完整的参数,后面使用保存下来的参数?
The text was updated successfully, but these errors were encountered: