[libc++] [ranges] Implement std::ranges::distance

This includes an experimental workaround for
LWG3664 "LWG3392 broke std::ranges::distance(a, a+3)",
but the workaround may be incomplete, I'm not sure.
This should be re-audited when LWG3664 is actually adopted,
to see if we need to change anything about our implementation.

See also https://github.com/microsoft/STL/pull/2500

Differential Revision: https://reviews.llvm.org/D117940

GitOrigin-RevId: c965d5448ecdf9a5513983862a78a2ba8f7fbab8
7 files changed