#include <iostream>
using namespace std;
template<typename T>
struct removeconst
{
using type = T;
};
template<typename T>
struct removeconst<const T>
{
using type = T;
};
/*别名模板*/
template <typename T>
using removeconst_t = typename removeconst<T>::type;
int main()
{
removeconst_t<const int> a = 10;
/*a是int类型,可以改变值*/
a = 11;
std::cout << typeid(a).name() << std::endl;
return 0;
}
固定萃取,const属性去除
最新推荐文章于 2023-12-06 22:34:54 发布