Skip to content

Commit bc800ad

Browse files
committed
Add as() functions to std::optional
1 parent 1d6e7d0 commit bc800ad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/cpp2util.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,14 @@ auto optional_as(T&& t) -> auto {
675675
}
676676
}
677677

678+
template< typename O, typename T >
679+
auto as(T&& t) -> auto
680+
requires (is<std::optional>(O{}))
681+
{
682+
using C = typename O::value_type;
683+
return cpp2::optional_as<C>(std::forward<T>(t));
684+
}
685+
678686
//-------------------------------------------------------------------------------------------------------------
679687
// std::variant is and as
680688
//

0 commit comments

Comments
 (0)