How to catch exception thrown while initializing a static member

后端 未结 5 626
轻奢々
轻奢々 2020-12-18 01:06

I have a class with a static member:

class MyClass
{
public:
    static const SomeOtherClass myVariable;
};

Which I initialize in the CPP f

5条回答
  •  被撕碎了的回忆
    2020-12-18 02:01

    You can wrap the function inside another function that catches the exception and alerts the user of the problem (or creates the key with a safe default value)

提交回复
热议问题