Skip to content
Snippets Groups Projects
Commit a3963b07 authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Karsten Rink
Browse files

[App/IO] compile-time type check

parent 4c67ae41
No related branches found
No related tags found
No related merge requests found
...@@ -54,16 +54,14 @@ public: ...@@ -54,16 +54,14 @@ public:
template<typename T> template<typename T>
bool addVectorForWriting(std::string const& vec_name, std::vector<T> const& vec) bool addVectorForWriting(std::string const& vec_name, std::vector<T> const& vec)
{ {
if (typeid(vec) == typeid(std::vector<std::string>) || static_assert(std::is_same<T, std::string>::value
typeid(vec) == typeid(std::vector<double>) || || std::is_same<T, double>::value
typeid(vec) == typeid(std::vector<int>)) || std::is_same<T, int>::value,
{ "CsvInterface can only write vectors of strings, doubles or ints.");
_vec_names.push_back(vec_name);
_data.push_back(vec); _vec_names.push_back(vec_name);
return true; _data.push_back(vec);
} return true;
ERR ("Vector type currently not supported.");
return false;
} }
/// Writes the CSV file. /// Writes the CSV file.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment