Skip to content
Snippets Groups Projects
Commit 137c8407 authored by Jorrit Fahlke's avatar Jorrit Fahlke
Browse files

[ConfigParser] Implement the non-specialized version of the

ConfigParser::Parser helper template.

This makes configparsertest compile.

[[Imported from SVN: r6009]]
parent 00620736
No related branches found
No related tags found
No related merge requests found
......@@ -328,6 +328,25 @@ namespace Dune {
static std::string rtrim(const std::string& s);
};
template<typename T>
struct ConfigParser::Parser {
static T parse(const std::string& str) {
T val;
std::istringstream s(str);
s >> val;
if(!s)
DUNE_THROW(RangeError, "Cannot parse value \"" << str << "\" "
"as a " << typeid(T).name());
T dummy;
s >> dummy;
// now extraction should have failed, and eof should be set
if(not s.fail() or not s.eof())
DUNE_THROW(RangeError, "Cannot parse value \"" << str << "\" "
"as a " << typeid(T).name());
return val;
}
};
template<typename T, int n>
struct ConfigParser::Parser<FieldVector<T, n> > {
static FieldVector<T, n>
......
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