We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f5d328 commit 145bc7eCopy full SHA for 145bc7e
include/cpp2util.h
@@ -686,6 +686,22 @@ auto as(T&& t) -> auto
686
return cpp2::optional_as<C>(std::forward<T>(t));
687
}
688
689
+template< typename T >
690
+struct strict {
691
+ using type = T;
692
+};
693
+
694
+template< typename S, typename T >
695
+auto as(T&& t) -> auto
696
+ requires (
697
+ requires {S::type;}
698
+ && std::is_same_v<cpp2::strict<typename S::type>,S>
699
+ )
700
+{
701
+ using C = typename S::type;
702
+ return cpp2::strict_as<C>(std::forward<T>(t));
703
+}
704
705
//-------------------------------------------------------------------------------------------------------------
706
// std::variant is and as
707
//
0 commit comments