I want to create a big std::vector
so operator[]
should receive long long
rather than unsigned int
, I tried writing my own allocator:
template <typename T>
struct allocator64 : std::allocator<T> {
typedef long long difference_type;
typedef unsigned long long size_type;
};
But when I try the following:
long long n = 5;
std::vector<int, allocator64<int> > vec(n);
vec[n-1] = 2;
I get the following warning for the second and third line:
warning C4244: 'argument' : conversion from '__int64' to 'unsigned int', possible loss of data
What am I missing? I thought the type for operator[]
and for the size constructor should come from allocator::size_type
.
I'm using VS9 (2008).