Files CCore/inc/gadget/NoThrowFlags.h CCore/src/gadget/NoThrowFlags.cpp
In CCore we need to determine two type properties: if a type has a nothrow default constructor (or has no the default constructor at all) and if a type has a nothrow copy constructor (or has no the copy constructor at all). NoThrowFlags is a tool which declare these type properties of a class. You are responsible that the declaration is correct!
Th declare class properties the base class SetNoThrowFlags is used:
class SomeClass : public SetNoThrowFlags<SomeClass, /* Default_no_throw */ true, /* Copy_no_throw */ true>
{
....
};
If a class has no such base class, the default way to determine these class properties is used. To do it the standard Meta-functions std::is_default_constructible and other are used. If a "bad" result is encountered (false) a warning is emitted. You can set these properties true by adding the noexcept qualifier to the declaration of the default or copy constructor.
class SomeClass { public: SomeClass() noexcept; SomeClass(const SomeClass &obj) noexcept; };
To retrieve NoThrowFlags the following Meta-class is used:
template <class T>
struct GetNoThrowFlags
{
enum NoThrowFlagType
{
Default_no_throw = ....,
Copy_no_throw = ....
};
};