#include <iostream>
#include <vector>
template<typename T>
class TypeTraits{
private:
template<typename U> class UnConst{
public:
typedef U Result;
};
template<typename U> class UnConst<const U>{
public:
typedef U Result;
};
public:
typedef typename UnConst<T>::Result NonConstType;
};
template<typename T>
using NonConstType = typename TypeTraits<T>::NonConstType;
template<typename T>
void Func(NonConstType<T> t) {
std::string* nonP = &t;
std::string& nonR = t;
std::cout<<*nonP<<std::endl;
}
template<typename T>
void ForwardFunc(NonConstType<T> t) {
Func<T>(t);
}
void Test(){
const int a = 10;
TypeTraits<const int>::NonConstType noConstVar;
int *p = &noConstVar;
const std::string str("hello");
ForwardFunc<const std::string>(str);
}
int main(){
Test();
}