I have an attribute vector that can hold different types:
class base_attribute_vector; // no template args
template
class raw_attribute_ve
Largely based on Jarod42's answer, this is what I will be using:
class base_attribute_vector {};
template
class raw_attribute_vector : public base_attribute_vector {
public:
raw_attribute_vector() {std::cout << typeid(T).name() << std::endl; }
};
template class impl>
base* magic(std::string type) {
if(type == "int") return new impl();
else if(type == "float") return new impl();
}
int main() {
auto x = magic("int");
auto y = magic("float");
}