I have written a simple C++11 style stateful allocator type. Given
template class my_allocator {
// the usual stuff
};
template
There are 3 solutions to your problem:
I. If your vector 'y' does not exist yet, you could use :
std::vector y(x.begin(), x.end());
II. If your vector 'y' already exist, you could use : (e.g. for a member of a class)
this->y.assign(x.begin(), x.end());
These 2 ways to fill a vector are not looking the container type. (and therefore the allocator type)
III. Another solution is to create a parent class which could be used as an allocator adapter between the std allocator and your own allocator. In this case, your 2 allocators are of the same type, and could be used with vector methods like operator=().