File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -27,20 +27,22 @@ namespace platform {
27
27
28
28
This wrap is a hack to avoid this bug.
29
29
*/
30
- template <class Callable , class ... Args>
30
+ template <typename Callable, typename ... Args>
31
31
inline void call_once (std::once_flag& flag, Callable&& f, Args&&... args) {
32
32
bool good = false ;
33
33
std::exception ex;
34
- std::call_once (flag, [&]() {
35
- try {
36
- f (args...);
37
- good = true ;
38
- } catch (const std::exception& e) {
39
- ex = e;
40
- } catch (...) {
41
- ex = std::runtime_error (" excption caught in call_once" );
42
- }
43
- });
34
+ std::call_once (flag,
35
+ [&](Args&&... args) {
36
+ try {
37
+ f (args...);
38
+ good = true ;
39
+ } catch (const std::exception& e) {
40
+ ex = e;
41
+ } catch (...) {
42
+ ex = std::runtime_error (" excption caught in call_once" );
43
+ }
44
+ },
45
+ args...);
44
46
if (!good) {
45
47
throw std::exception (ex);
46
48
}
You can’t perform that action at this time.
0 commit comments