0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00

jsonhelper: extend polymorphism to allow string or numerical indices

Updated StringTempl to work with numeric types.

Signed-off-by: James Yonan <james@openvpn.net>
This commit is contained in:
James Yonan 2018-03-10 16:06:59 -07:00 committed by Lev Stipakov
parent f02ea1f762
commit 02b531e619
No known key found for this signature in database
GPG Key ID: 88670BE258B9C258

View File

@ -22,6 +22,9 @@
#pragma once
#include <string>
#include <type_traits>
#include <openvpn/common/stringtempl.hpp>
namespace openvpn {
@ -33,5 +36,12 @@ namespace openvpn {
return t.to_string();
}
template <typename T,
typename std::enable_if<std::is_arithmetic<T>::value, int>::type = 0>
inline std::string to_string(T value)
{
return std::to_string(value);
}
}
}