You can overload your function for different types, i.e.
size_t func(int);
size_t func(std::string);
/ template, , ,
template<typename T>
size_t func(T const&) { return sizeof(T); }
, SFINAE, , T (.. , , , pod ..). func() ( ) , , , , .
.
, , boost::any, ( )
size_t func(boost::any const&x)
{
auto i = boost::any_cast<const int*>(x);
if(i) return func(*i);
}