Disable copy constructor of Session

Since only one instance of Catch::Session can ever be used.

While trying to call session in my own function, I made a mistake of
passing session object by value. It called copy constructor and
destructor later, which called Catch::clean(). Disabling copy
constructor of session can prevent similar mistakes.
This commit is contained in:
Chenliang Xu 2014-09-27 21:28:00 -05:00
parent d4e5f18436
commit 25f196098e
1 changed files with 4 additions and 0 deletions

View File

@ -100,6 +100,10 @@ namespace Catch {
class Session { class Session {
static bool alreadyInstantiated; static bool alreadyInstantiated;
private:
// Prevent copy constructor
Session(const Session& other);
public: public:
struct OnUnusedOptions { enum DoWhat { Ignore, Fail }; }; struct OnUnusedOptions { enum DoWhat { Ignore, Fail }; };