Skip to content

Commit

Permalink
Remove unevaluated lambdas from bsl::optional implementation (#4734)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3nsor authored and GitHub Enterprise committed May 8, 2024
1 parent b3355be commit dba429f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
16 changes: 10 additions & 6 deletions groups/bsl/bslstl/bslstl_optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,12 @@ struct Optional_Data<TYPE, true> : public Optional_DataImp<TYPE> {
namespace bsl {

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
template <class t_TYPE>
void optional_acceptsBslOptional(const bsl::optional<t_TYPE>&);

template <class t_TYPE>
void optional_acceptsStdOptional(const std::optional<t_TYPE>&);

template <class t_TYPE>
concept Optional_ConvertibleToBool =
// This component-private concept models the Standard's exposition-only
Expand All @@ -715,16 +721,14 @@ template <class t_TYPE>
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) {
[]<class U>(const bsl::optional<U>&){}(t);
};
requires (const t_TYPE& t) { optional_acceptsBslOptional(t); };

template <class t_TYPE>
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) {
[]<class U>(const std::optional<U>&){}(t);
};
requires (const t_TYPE& t) { optional_acceptsStdOptional(t); };

template <class t_TYPE>
concept Optional_DerivedFromOptional =
// This component-private concept models whether a type is derived from one
Expand Down
18 changes: 11 additions & 7 deletions groups/bsl/bslstl/bslstl_optional_cpp03.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -904,6 +904,12 @@ struct Optional_Data<TYPE, true> : public Optional_DataImp<TYPE> {
namespace bsl {

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS
template <class t_TYPE>
void optional_acceptsBslOptional(const bsl::optional<t_TYPE>&);

template <class t_TYPE>
void optional_acceptsStdOptional(const std::optional<t_TYPE>&);

template <class t_TYPE>
concept Optional_ConvertibleToBool =
// This component-private concept models the Standard's exposition-only
Expand All @@ -914,16 +920,14 @@ template <class t_TYPE>
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) {
[]<class U>(const bsl::optional<U>&){}(t);
};
requires (const t_TYPE& t) { optional_acceptsBslOptional(t); };

template <class t_TYPE>
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) {
[]<class U>(const std::optional<U>&){}(t);
};
requires (const t_TYPE& t) { optional_acceptsStdOptional(t); };

template <class t_TYPE>
concept Optional_DerivedFromOptional =
// This component-private concept models whether a type is derived from one
Expand Down

0 comments on commit dba429f

Please sign in to comment.