diff options
author | Lee Clagett <code@leeclagett.com> | 2017-12-19 20:30:02 -0500 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2018-01-18 02:26:19 -0500 |
commit | 951716146fc288b60604ba1b93b34032f37a47d8 (patch) | |
tree | 8341cfc1d7bc693072c3b89842140d78be85765f /contrib/epee/include/string_tools.h | |
parent | Merge pull request #3091 (diff) | |
download | monero-951716146fc288b60604ba1b93b34032f37a47d8.tar.xz |
Remove is_pod trait, and replace with is_standard_layout requirement
Diffstat (limited to 'contrib/epee/include/string_tools.h')
-rw-r--r-- | contrib/epee/include/string_tools.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index 5a1ef0743..63705e401 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -45,6 +45,7 @@ #include <boost/lexical_cast.hpp> #include <boost/algorithm/string/predicate.hpp> #include "hex.h" +#include "memwipe.h" #include "span.h" #include "warnings.h" @@ -330,7 +331,7 @@ POP_WARNINGS template<class t_pod_type> std::string pod_to_hex(const t_pod_type& s) { - static_assert(std::is_pod<t_pod_type>::value, "expected pod type"); + static_assert(std::is_standard_layout<t_pod_type>(), "expected standard layout type"); return to_hex::string(as_byte_span(s)); } //---------------------------------------------------------------------------- @@ -351,6 +352,12 @@ POP_WARNINGS return true; } //---------------------------------------------------------------------------- + template<class t_pod_type> + bool hex_to_pod(const std::string& hex_str, tools::scrubbed<t_pod_type>& s) + { + return hex_to_pod(hex_str, unwrap(s)); + } + //---------------------------------------------------------------------------- bool validate_hex(uint64_t length, const std::string& str); //---------------------------------------------------------------------------- inline std::string get_extension(const std::string& str) |