From dba429f1110b91fcbd3a7ee358edcac38d0c0209 Mon Sep 17 00:00:00 2001 From: Brian Bi Date: Wed, 8 May 2024 15:58:12 -0400 Subject: [PATCH] Remove unevaluated lambdas from bsl::optional implementation (#4734) --- groups/bsl/bslstl/bslstl_optional.h | 16 ++++++++++------ groups/bsl/bslstl/bslstl_optional_cpp03.h | 18 +++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/groups/bsl/bslstl/bslstl_optional.h b/groups/bsl/bslstl/bslstl_optional.h index 45f53d81ad..36139cbb10 100644 --- a/groups/bsl/bslstl/bslstl_optional.h +++ b/groups/bsl/bslstl/bslstl_optional.h @@ -705,6 +705,12 @@ struct Optional_Data : public Optional_DataImp { namespace bsl { #ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS +template +void optional_acceptsBslOptional(const bsl::optional&); + +template +void optional_acceptsStdOptional(const std::optional&); + template concept Optional_ConvertibleToBool = // This component-private concept models the Standard's exposition-only @@ -715,16 +721,14 @@ template concept Optional_DerivedFromBslOptional = // This component-private concept is used in the subsequent implementation // of the component-private concept 'Optional_DerivedFromOptional'. - requires(const t_TYPE &t) { - [](const bsl::optional&){}(t); - }; + requires (const t_TYPE& t) { optional_acceptsBslOptional(t); }; + template concept Optional_DerivedFromStdOptional = // This component-private concept is used in the subsequent implementation // of the component-private concept 'Optional_DerivedFromOptional'. - requires(const t_TYPE &t) { - [](const std::optional&){}(t); - }; + requires (const t_TYPE& t) { optional_acceptsStdOptional(t); }; + template concept Optional_DerivedFromOptional = // This component-private concept models whether a type is derived from one diff --git a/groups/bsl/bslstl/bslstl_optional_cpp03.h b/groups/bsl/bslstl/bslstl_optional_cpp03.h index bfb3dfb603..272bd30ecd 100644 --- a/groups/bsl/bslstl/bslstl_optional_cpp03.h +++ b/groups/bsl/bslstl/bslstl_optional_cpp03.h @@ -21,7 +21,7 @@ // regions of C++11 code, then this header contains no code and is not // '#include'd in the original header. // -// Generated on Thu Jan 11 05:07:56 2024 +// Generated on Wed May 8 14:37:33 2024 // Command line: sim_cpp11_features.pl bslstl_optional.h #ifdef COMPILING_BSLSTL_OPTIONAL_H @@ -904,6 +904,12 @@ struct Optional_Data : public Optional_DataImp { namespace bsl { #ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS +template +void optional_acceptsBslOptional(const bsl::optional&); + +template +void optional_acceptsStdOptional(const std::optional&); + template concept Optional_ConvertibleToBool = // This component-private concept models the Standard's exposition-only @@ -914,16 +920,14 @@ template concept Optional_DerivedFromBslOptional = // This component-private concept is used in the subsequent implementation // of the component-private concept 'Optional_DerivedFromOptional'. - requires(const t_TYPE &t) { - [](const bsl::optional&){}(t); - }; + requires (const t_TYPE& t) { optional_acceptsBslOptional(t); }; + template concept Optional_DerivedFromStdOptional = // This component-private concept is used in the subsequent implementation // of the component-private concept 'Optional_DerivedFromOptional'. - requires(const t_TYPE &t) { - [](const std::optional&){}(t); - }; + requires (const t_TYPE& t) { optional_acceptsStdOptional(t); }; + template concept Optional_DerivedFromOptional = // This component-private concept models whether a type is derived from one