gcc 5.4中 string_view和optional

#if defined(__GNUC__) && __GNUC__ < 7
# include <experimental/string_view>
# include <experimental/optional>
# define string_view experimental::string_view
# define optionalexperimental::optional
#else
# include <string_view>
# include <optional>
#endif

string_view在gcc 5.4时可以用to_string成员方法转成std::string
optional 在gcc 5.4时,可以用 opt == std::experimental::nullopt 来判断是否有值

posted @ 2022-12-02 17:42  马肯尼煤牙巴骨  阅读(63)  评论(0)    收藏  举报