MVault 0.0.1
Loading...
Searching...
No Matches
ToString.h
1#pragma once
2
3#include <string>
4
5namespace mvlt
6{
74 template <class T>
75 std::string ToString(const T& data) noexcept { return ""; }
76
86 template <>
87 inline std::string ToString(const long long int& data) noexcept { return std::to_string(data); }
88
98 template <>
99 inline std::string ToString(const unsigned long long int& data) noexcept { return std::to_string(data); }
100
110 template <>
111 inline std::string ToString(const long int& data) noexcept { return std::to_string(data); }
112
122 template <>
123 inline std::string ToString(const unsigned long int& data) noexcept { return std::to_string(data); }
124
134 template <>
135 inline std::string ToString(const int& data) noexcept { return std::to_string(data); }
136
146 template <>
147 inline std::string ToString(const unsigned int& data) noexcept { return std::to_string(data); }
148
158 template <>
159 inline std::string ToString(const short int& data) noexcept { return std::to_string(data); }
160
170 template <>
171 inline std::string ToString(const unsigned short int& data) noexcept { return std::to_string(data); }
172
182 template <>
183 inline std::string ToString(const bool& data) noexcept { if(data) return "true"; else return "false"; }
184
194 template <>
195 inline std::string ToString(const std::string& data) noexcept { return data; }
196
206 template <>
207 inline std::string ToString(const float& data) noexcept { return std::to_string(data); }
208
218 template <>
219 inline std::string ToString(const double& data) noexcept { return std::to_string(data); }
220
230 template <>
231 inline std::string ToString(const char& data) noexcept { return std::string(1, data); }
232
234}
std::string ToString(const T &data) noexcept
A template method for providing an interface converting any type to a string.
Definition ToString.h:75