Here is code, I don't understand star sign(*) in std::string(*)
using boost::algorithm::join;
using boost::adaptors::transformed;
auto tostr = static_cast<std::string(*)(int)>(std::to_string);
Here is original code
Here is code, I don't understand star sign(*) in std::string(*)
using boost::algorithm::join;
using boost::adaptors::transformed;
auto tostr = static_cast<std::string(*)(int)>(std::to_string);
Here is original code
It's a pointer to function accepting int
parameter and returning std::string
- exactly what std::to_string
does.
As @PeteBecker pointed out, the cast there is needed because there are actuall multiple overloads for to_string
, accepting different arguments (ints, doubles, shorts, etc). The cast allows the compiler to pick one of them.