Libstdc++: Add missing constraints to vector and deque deduction guides
Adds constraints to `vector` and `deque` deduction guides to ensure they only accept valid allocator types.
This commit fixes missing constraints in the deduction guides for std::vector and std::deque. The deduction guides now require that the deduced type for the allocator argument must qualify as an allocator. This prevents unexpected behavior and ensures that the containers are constructed with valid allocator types. New test cases are added to verify that deduction fails when a non-allocator type is used.
In Details
Deduction guides allow class template arguments to be deduced from constructor arguments. This commit adds std::is_same_v<std::allocator_traits<Allocator>::value_type, T> and std::uses_allocator_v<T, Allocator> constraints to the deduction guides for std::vector and std::deque. This ensures that the deduced Allocator type actually works as an allocator for the element type T in the container.
For Context
In C++, deduction guides help the compiler automatically determine the template arguments of a class based on the arguments provided to its constructor. Allocators are used by containers like std::vector and std::deque to manage memory allocation. This commit ensures that when the compiler automatically deduces the allocator type, it only selects types that are valid allocators, preventing potential errors or unexpected behavior related to memory management.