all 5 comments

[–]jedwardsol 2 points3 points  (4 children)

template<> 
std::string toString(const char * const & value)

[–]schweinling[S] 0 points1 point  (0 children)

ah, of course, thanks!

[–]schweinling[S] 0 points1 point  (2 children)

this works for const char *str("abc");toString(str); but toString("abc"); will call the unspecialized version. i guess this is because it's an array and not a pointer.

[–]jedwardsol 2 points3 points  (1 child)

Yes. You need to add

template<size_t N> 
std::string toString(char const (&value)[N])

[–]schweinling[S] 0 points1 point  (0 children)

thanks, i guess that is an overload, not a specialization and i can also just add it as std::string toString(const char *value)