[c++] Checking if a variable is initialized

If you donot like boost and c++17, the google c++ lib Abseil is another method to realize that. absl::optional is just like std::optional.

#include <absl/types/optional.h>
class MyClass
{
    void SomeMethod();

    absl::optional<char> mCharacter;
    absl::optional<double> mDecimal;
};

void MyClass::SomeMethod()
{
    if (mCharacter)
    {
        // do something with mCharacter.
    }

    if (!mDecimal)
    {
        // define mDecimal.
    }
}