microsoft / GSL

Guidelines Support Library
Other
6.11k stars 736 forks source link

Use the implementation-defined strict total order for pointer comparisons with `not_null` #1106

Closed dmitrykobets-msft closed 1 year ago

dmitrykobets-msft commented 1 year ago

Using <,<=,>,>= to compare unrelated pointers gives an unspecified result according to standard. This PR replaces the usage of these operators in gsl::not_null with the STL counterparts, which would leverage any implementation-defined strict total ordering for pointers.

Resolves #880