From f376942ba07161a11fb61cfab4da9910a2086bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Joly?= Date: Thu, 19 Dec 2024 16:45:31 +0100 Subject: [PATCH] Add introduction --- rules/S7172/cfamily/rule.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/S7172/cfamily/rule.adoc b/rules/S7172/cfamily/rule.adoc index 9740b31ba74..46e00b79655 100644 --- a/rules/S7172/cfamily/rule.adoc +++ b/rules/S7172/cfamily/rule.adoc @@ -1,3 +1,4 @@ +This rule raises an issue when `std::optional`, `boost::optional`, or `std::expected` wrap a basic type, and a conversion from the wrapper type to `bool` is used to test the presence of a contained value. == Why is this an issue? @@ -13,7 +14,7 @@ if(flag.has_value()) { ... } When the contained type is also convertible to `bool`, using this concise syntax can be confusing. What is tested: The wrapper, or the contained value? -This rule raises an issue when `std::optional`, `boost::optional`, or `std::expected` wrap a basic type, and the conversion to `bool` is used to test presence of the value. +This rule raises an issue when `std::optional`, `boost::optional`, or `std::expected` wrap a basic type, and the conversion to `bool` is used to test the presence of the value. === What is the potential impact?