diff options
-rw-r--r-- | src/utils/parsing.cpp | 5 | ||||
-rw-r--r-- | src/utils/parsing.h | 3 | ||||
-rw-r--r-- | src/utils/stl_util.h | 13 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/utils/parsing.cpp b/src/utils/parsing.cpp index c3d7f00f7..1e90f2f6e 100644 --- a/src/utils/parsing.cpp +++ b/src/utils/parsing.cpp @@ -12,6 +12,11 @@ namespace Botan { +u32bit to_u32bit(const std::string& str) + { + return std::stoul(str); + } + /* * Convert a string into a time duration */ diff --git a/src/utils/parsing.h b/src/utils/parsing.h index f0d865ca7..bdf61a075 100644 --- a/src/utils/parsing.h +++ b/src/utils/parsing.h @@ -72,8 +72,7 @@ BOTAN_DLL bool x500_name_cmp(const std::string& name1, * @param str the string to convert * @return number value of the string */ -inline u32bit to_u32bit(const std::string& str) - { return std::stoul(str); } +BOTAN_DLL u32bit to_u32bit(const std::string& str); /** * Convert a time specification to a number diff --git a/src/utils/stl_util.h b/src/utils/stl_util.h index 5e4d23c7f..0710d61a5 100644 --- a/src/utils/stl_util.h +++ b/src/utils/stl_util.h @@ -76,6 +76,19 @@ bool value_exists(const std::vector<T>& vec, return false; } +template<typename T, typename Pred> +void map_remove_if(Pred pred, T& assoc) + { + auto i = assoc.begin(); + while(i != assoc.end()) + { + if(pred(i->first)) + assoc.erase(i++); + else + i++; + } + } + } #endif |