Merge unordered to release. Fixes #8851, #8874

Avoid some warnings, and move detail functions into a sub-namespace to avoid
exposing them via. ADL.