aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-01 15:10:54 -0400
committerYour Name <you@example.com>2021-05-01 15:10:54 -0400
commit7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d (patch)
treed9b808542216f71dbab053ad23145903e96c6401 /src/utils.h
parent5a813a75412ac9b8fadb90c9abd46dd95aee8e9b (diff)
downloaddmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.tar.gz
dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.tar.bz2
dmtool-7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d.zip
Added bash completion, amongst others
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index bdf7ddc..e44bdf2 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -29,6 +29,18 @@ namespace utils {
}
}
+ template<typename F, typename T> std::vector<std::shared_ptr<T>> castPtrs(std::vector<std::shared_ptr<F>> from) {
+ std::vector<std::shared_ptr<T>> Ts;
+ for(std::shared_ptr<F> f : from) {
+ std::shared_ptr<T> t = dynamic_pointer_cast<T>(f);
+ if(t) {
+ Ts.push_back(t);
+ }
+ }
+ return Ts;
+ }
+
+
template<typename Container> std::string join(Container parts, std::string joiner) {
std::stringstream out;
bool isFirst = true;