소스 검색

feat(c++): add remove_cv, decay

greatbridf 2 년 전
부모
커밋
41b56ecb26
1개의 변경된 파일26개의 추가작업 그리고 0개의 파일을 삭제
  1. 26 0
      include/types/cplusplus.hpp

+ 26 - 0
include/types/cplusplus.hpp

@@ -48,6 +48,32 @@ struct add_reference {
     using type = T&;
 };
 
+template <typename T>
+struct remove_cv {
+    using type = T;
+};
+template <typename T>
+struct remove_cv<const T> {
+    using type = T;
+};
+template <typename T>
+struct remove_cv<volatile T> {
+    using type = T;
+};
+template <typename T>
+struct remove_cv<const volatile T> {
+    using type = T;
+};
+
+template <typename T>
+struct decay {
+private:
+    using U = remove_reference<T>;
+
+public:
+    using type = typename remove_cv<U>::type;
+};
+
 } // namespace types::traits
 
 namespace types {