From e1519765bae02e5f585365d6805fc487da6bec5d Mon Sep 17 00:00:00 2001 From: sauron Date: Sun, 5 Oct 2025 21:00:58 +0900 Subject: [PATCH] commit 2025-10-05 21:00 add operator bool() in ZtCObjOpt : ZCppMain/ZMainHead.H --- ZCppMain/ZMainHead.H | 3 ++- ZCppMainTest/ZtCLinkList_000.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index e256291..7722f7a 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -4512,7 +4512,8 @@ namespace ZNsMain ZtCObjOpt& operator=(const ZtCObjOpt& rhs) { mp_TypeData=rhs.mp_TypeData; return *this; } - bool has_value() const{return mp_TypeData!=0;} + operator bool () const{return mp_TypeData!=0;} + bool has_value () const{return mp_TypeData!=0;} TypeData& value() const{return *mp_TypeData ;} diff --git a/ZCppMainTest/ZtCLinkList_000.cpp b/ZCppMainTest/ZtCLinkList_000.cpp index 22c49aa..4dc3280 100644 --- a/ZCppMainTest/ZtCLinkList_000.cpp +++ b/ZCppMainTest/ZtCLinkList_000.cpp @@ -49,6 +49,7 @@ namespace ZNsMain ZCStrLinkOpt VO_StrLinkOpt = VO_ZCLinkStrLis.GetObjOpt(1); cout<<"# VO_StrLinkOpt.has_value()="<