Thursday, July 3, 2014

According to, one class that can be used as an allocator type must meet many requirements. However, I cannot find the same requirements specified by the C++ standard. The standard only requires the allocator type must not be a non-class type. (see n3797

If I have an empty class Alloc and a fully specialized std::allocator_traits<Alloc>, can I use Alloc as follows:

#include <vector>

struct Alloc {};

// full definitions as per the requirements for std::allocator_traits<T>

int main()
std::vector<int, Alloc> coll;