I am currently working on a console graphical library for C ++ 11 to facilitate some debugging and more.
For a specific class that contains templates, I want to make sure that I can convert the template type to a string before printing it.
Example:
template<typename T>
class listbox {
private:
std::vector<T> list;
[...]
public:
std::string print_item(T& item) { }
}
So, in the "Static Assert" section, I want to check if I can convert the element to std::string(or const char*will work the same way), so really the question is simple, how can I approve the conversion from a template type?
I know that the / ide compiler will respond to types that cannot recognize it, but I need a fixed type to be able to control the string more.