|
|
От: |
ArtDenis
|
|
| Дата: | 09.02.07 09:27 | ||
| Оценка: | |||
#include <stdio.h>
#include <boost/type_traits.hpp>
template<typename T> char* ArgToStr(T t, char *str)
{
sprintf
(
str,
boost::is_floating_point<T>::value ? "%f" :
boost::is_integral<T>::value ? "%i" : "s",
t
);
return str;
}
int main()
{
char buffer[10];
ArgToStr(1, buffer);
ArgToStr(0.21, buffer);
}