Namespaces
Variants
Views
Actions

Talk:cpp/types/type info/operator cmp

From cppreference.com

Maybe someone could take a look again on `operator==` and if it's required to return `false` in case the two types are different. Quoting [type.info]/3:

> Returns: true if the two values describe the same type.

Note there's no ", false otherwise" as e.g. in [util.smartptr.shared.atomic]/4

About "false otherwise" -- you're correct that some parts of the standard omit "false otherwise", but my guess is that's just inconsistent wording. For example, std::is_partitioned and std::binary_search have similar omissions, but it seems unlikely to me that e.g. std::binary_search isn't defined to return false when the element being searched for isn't there. --Nate 10:14, 27 April 2013 (PDT)
It would be hard to believe that the standard doesn't imply "false otherwise". What's the utility of a feature that can't be relied on? Ensuring that typeinfo for different types don't compare equal is not hard. P12 14:24, 27 April 2013 (PDT)

Additionally, I think the description is not clear enough ("if the comparison holds"). Actually, it should be like in the quotation above, namely "if the two values describe the same type".

--91.14.101.130 08:16, 27 April 2013 (PDT)DyP