aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-11-02 18:44:17 +0000
committerlloyd <[email protected]>2012-11-02 18:44:17 +0000
commit4d99f95923789513528617347c435e981b20689b (patch)
tree21b9bb943f97580285d6868d99d72b6bafc8ace5 /src
parentba05a520c391fa2d605314ec9d07fc51c9ab45f6 (diff)
Move to_u32bit to source file. Add map_remove_if helper
Diffstat (limited to 'src')
-rw-r--r--src/utils/parsing.cpp5
-rw-r--r--src/utils/parsing.h3
-rw-r--r--src/utils/stl_util.h13
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