mercredi 28 février 2018

C++: Create integer vector of infinities

I'm working on an algorithm and I need to initialize the vector of ints:

std::vector<int> subs(10)

of fixed length with values:

{-inf, +inf, +inf …. }

This is where I read that it is possible to use MAX_INT, but it's not quiete correct because the elements of my vector are supposed to be greater than any possible int value.

I liked overrloading comparison operator method from this answer, but how do you initialize the vector with infinitytype class objects if there are supposed to be an int?

Thank you.

Aucun commentaire:

Enregistrer un commentaire