Q:

C++17 std::optional in G++?

cppreference.com - std::optional identifies std::optional as being available "since C++17". C++ Standards Support in GCC - C++1z Language Features Lists c++17 features. I do not see std::optional in the list. Were is std::optional documented for G++?
#include <string>
#include <iostream>
#include <optional>

// optional can be used as the return type of a factory that may fail
std::optional<std::string> create(bool b) {
    if(b)
        return "Godzilla";
    else
        return {};
}

int main()
{
    std::cout << "create(false) returned "
              << create(false).value_or("empty") << '\n';

    // optional-returning factory functions are usable as conditions of while and if
    if(auto str = create(true)) {
        std::cout << "create(true) returned " << *str << '\n';
    }
}

A:

You need to follow the "library implementation" link
https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.201z
it is described under Library Fundamentals V1 TS Components (Table 1.5).
That's because std::optional is a library feature, not a language feature, as mentioned in one of the comments.

