最終更新日時(UTC): 2019年11月26日 08時07分39秒 Akira Takahashi が更新
履歴 編集
bool has_value() const noexcept;
有効な値を保持しているかを判定する。
有効値を保持している場合にtrueを返し、そうでなければfalseを返す。
true
false
#include <cassert> #include <any> int main() { std::any x = 3; assert(x.has_value() == true); std::any y; assert(y.has_value() == false); }