diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-03-21 12:59:13 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-03-21 12:59:13 -0400 |
commit | 4272d8f94dd4c4b00ef42778c5c5255cfb94feba (patch) | |
tree | 54718092f44656b5be7770b5fb0e57bc1aef7bb0 /vec_builtin.h | |
parent | b5b2be38fe26632e51b42e60a3cb9714576a9a5a (diff) | |
download | vecmathlib-4272d8f94dd4c4b00ef42778c5c5255cfb94feba.zip vecmathlib-4272d8f94dd4c4b00ef42778c5c5255cfb94feba.tar.gz |
Don't use typeinfo
Diffstat (limited to 'vec_builtin.h')
-rw-r--r-- | vec_builtin.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/vec_builtin.h b/vec_builtin.h index 3765604..519aa86 100644 --- a/vec_builtin.h +++ b/vec_builtin.h @@ -10,8 +10,8 @@ #include <algorithm> #include <cmath> #include <cstring> +#include <sstream> #include <string> -#include <typeinfo> @@ -311,12 +311,10 @@ namespace vecmathlib { static char const* name() { static std::string name_; - if (name_.length()==0) { - std::string base; - if (typeid(T) == typeid(float)) base = "float"; - else if (typeid(T) == typeid(double)) base = "double"; - else base = typeid(T).name(); - name_ = std::string("<builtin:") + std::to_string(N) + "*" + base + ">"; + if (name_.empty()) { + stringstream buf; + buf << "<builtin:" << N << "*" << FP::name() << ">"; + name_ = buf.str(); } return name_.c_str(); } |