| Home | Libraries | People | FAQ | More

#### Mixed relational comparisons

Because `T` is convertible to `optional<T>` and because `optional<T>` is `LessThanComparable` when `T` is `LessThanComparable`, you can sometimes get an unexpected runtime result where you would rather expect a compiler error:

    optional<double> Flight_plan::weight(); // sometimes no weight can be returned

    bool is_aircraft_too_heavy(Flight_plan const& p)
    {
       return p.weight() > p.aircraft().max_weight(); // compiles!
    }                                                 // returns false when the optional contains no value