rt,想实现一个万能prinf,CE了
#ifndef EASY_CPP_H_INCLUDED
#define EASY_CPP_H_INCLUDED
#include<string>
#include<cstdio>
using namespace std;
template<typename T>
constexpr bool __is_int=false;
template<>
constexpr bool __is_int<int>=true;
template<>
constexpr bool __is_int<long>=true;
template<typename T>
constexpr bool __is_char=false;
template<>
constexpr bool __is_char<char>=true;
template<typename T>
constexpr bool __is_long_long=false;
template<>
constexpr bool __is_long_long<long long>=true;
template<typename T>
constexpr bool __is_string=false;
template<>
constexpr bool __is_string<string>=true;
template<>
constexpr bool __is_string<char*>=true;
template<typename T>
constexpr bool __is_float=false;
template<>
constexpr bool __is_float<float>=true;
template<typename T>
constexpr bool __is_double=false;
template<>
constexpr bool __is_double<double>=true;
template<typename T>
constexpr bool __is_ldouble=false;
template<>
constexpr bool __is_ldouble<long double>=true;
template<typename T>
constexpr bool __is_ull=false;
template<>
constexpr bool __is_ull<unsigned long long>=true;
namespace ec{
template<typename T>
void print(T x){
string type;
if(__is_int<T>){
type="%d";
}
else if(__is_char<T>){
type="%c";
}
else if(__is_long_long<T>){
type="%lld";
}
else if(__is_string<T>){
type="%s";
}
else if(__is_float<T>){
type="%f";
}
else if(__is_double<T>){
type="%lf";
}
else if(__is_ldouble<T>){
type="%llf";
}
else if(__is_ull<T>){
type="%ulld";
}
printf(type.c_str(),x);
return;
}
template<typename T,typename... Args>
void print(T x,Args... args){
print(x);
print(args...);
}
}
#endif