من میخوام برای وکتور یک allocator بنویسم که مموری align شده بر گردونه ولی نمی دونم چرا کد زیر ارور میده
#include <iostream>
#include <vector>
template <class Tp>
struct AlignedAllocator {
typedef Tp value_type;
AlignedAllocator(){}
template <class T> AlignedAllocator(const AlignedAllocator<T>& other){
}
Tp* allocate(std::size_t n){
return static_cast<Tp*>(_aligned_malloc(n, 16));
}
void deallocate(Tp* p, std::size_t n){
free(p);
}
};
template <class T, class U>
bool operator==(const AlignedAllocator<T>&, const AlignedAllocator<U>&){
return (static_cast<T>(Left) == static_cast<U>(Right));
}
template <class T, class U>
bool operator!=(const AlignedAllocator<T>& Left, const AlignedAllocator<U>& Right){
return (static_cast<T>(Left) == static_cast<U>(Right));
}
template<class T,class Allocator=AlignedAllocator<T>>
using AlignedVector = std::vector<T, Allocator>;
int main() {
AlignedVector<int> vec;
vec.push_back(5);
return 0;
}