23.2.1 [container.requirements.general]/7:
All other constructors for these container types take an
Allocator&
argument (17.6.3.5), an allocator whose value type is the same as the container’s value type.
So your code is invalid.
The above is a rather obscure place to find this, though. We can do better. Table 99 (allocator-aware container requirements) requires in its first row that the container has an allocator_type
nested type, whose value_type
is identical to the container's. And the synopsis for vector
(and the other containers) defines allocator_type
thus:
typedef Allocator allocator_type;
In other words, the Allocator
parameter you supply is responsible for fulfilling the requirement.