Why std::condition_variable is specced to only work with std::unique_lock<std::mutex>? Because it "allows for maximal efficiency on some platforms", like the docs say.
That way, condition_variable implementation can use its internal knowledge on stdlibrary implementation of unique_lock and mutex to perform the most efficient way of performing its function. E.g. libstdc++'s implementation contains this nugget:
pthread_cond_clockwait(&_M_cond,
__lock.mutex()->native_handle(), //< go right into guts of that unique_lock AND mutex
CLOCK_MONOTONIC, &__ts);
MSVC's STL:
_Cnd_wait(_Mycnd(), _Lck.mutex()->_Mymtx());
and then to SleepConditionVariableSRW.
In both cases, there is an effective native platform way to perform a wait on platform's native condition_variable counterpart, but it requires also a native mutex handle. So in order to use it, the implementation needs not only full access to the CV, but also to the mutex. This can only be done if the outer types are all internal to the implementation.
std::condition_variable_any has no such luxury, and it cannot directly access the mutex it is given. It has to adapt somehow. Usually that means it has its own internal mutex, and it has to perform sort of lock/unlock dance between its internal mutex and external mutex locker, in order to safely "adopt" lock invariant into its mutex, then use its internal mutex to do the job, and then to do another two-mutex lock/unlock dance to "give back" lock to the external mutex. condition_variable_any can do its job with any external mutex/locker it is given (even if that external mutex cannot be used by the platform's native CV primitives), but it does it at the expense of doing a whole lot of extra work and potentially worse scalability.
std::condition_variableworks only withstd::unique_lock, whilestd::condition_variable_anyworks with anything that isBasicLocable, i.e. haslock()andunlock().std::scoped_lockis notBasicLocableso it can't be used by either of the two.std::condition_variable.std::lock_guarddoes not have lock/unlock calls...