boost::optional return from function

Viewed 1051

I am reviewing some production code where a function says it will return a boost::optional, but it just returns a double: e.g.

boost::optional<double> Foo(){
   double a = 1.0;
   double b = 2.0;
   return a + b;
}

Is this acceptable style/are there any cases where this is unsafe?

1 Answers
Related