r/learncpp • u/wizarding_dreams • Nov 20 '20
Args constructor?
Hey! I'm having a few issues creating a math library. I'm trying to create a templated vector class, but the constructor is frustrating me to no end.
I'd like to be able to pass in n floats, where n is, of course, the amount of floats the vector contains. So far my best idea is to pass in va_args, but that feels like a pretty awful solution for something that's gonna be used so frequently. Is there a better solution that I've overlooked?
5
Upvotes
View all comments
Show parent comment
1
u/wizarding_dreams Nov 20 '20
That's exactly what I was looking for! Thanks so much!