mardi 28 juillet 2020

Return NULL from a method returning double [closed]

Consider the following code:

struct mult
{
  double operator()(double a, double b)
  {
    if (a.is_null() || b.is_null()) {
      return NULL;
    } else {
      return a * b;
    }
  }
};

Is there any way to return NULL? I don't want to return 0. a or b can be NULL. I want to achieve the result to be NULL if either one of that is NULL. I am considering NaN

Aucun commentaire:

Enregistrer un commentaire