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:
parent
f02ea1f762
commit
02b531e619
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user