I need nullable double and int. In C# I can use double?
and int?
, in C++ it seems we only have boost::optional
. However it seems boost:optional
doesn't support many things "out of the box", for example I can't easily devide variables
That's why I'm asking if this is a good idea at all to use boost::optional
in such simple case? I'm writing latency critical code so I'm choosing technologies thoroughly.
If boost::optional<double>
comparing to raw double + boolean
will be:
- signifficantly slower?
- error-phrone?
- less readable and mainanable?
- other problems?
upd i realized that i can just use double + isnan()
. i can use nan
instead of addition bool
field.