How is a vector’s data aligned?

C++ standard requires allocation functions (malloc() and operator new()) to allocate memory suitably aligned for any standard type. As these functions don’t receive the alignment requirement as an argument, in practice it means that the alignment for all allocations is the same, and is that of a standard type with the largest alignment requirement, which … Read more

Why are are std::allocator’s construct and destroy functions deprecated in c++17?

The allocator requirements table says that construct(c, args), if provided, must “construct an object of type C at c“. It says absolutely nothing about 1) what arguments are to be passed to C‘s constructor or 2) how these arguments are to be passed. That’s the allocator’s choice, and in fact two allocators in the standard … Read more

polymorphic_allocator: when and why should I use it?

Choice quote from cppreference: This runtime polymorphism allows objects using polymorphic_allocator to behave as if they used different allocator types at run time despite the identical static allocator type The issue with “regular” allocators is that they change the type of the container. If you want a vector with a specific allocator, you can make … Read more

Compelling examples of custom C++ allocators?

As I mention here, I’ve seen Intel TBB’s custom STL allocator significantly improve performance of a multithreaded app simply by changing a single std::vector<T> to std::vector<T,tbb::scalable_allocator<T> > (this is a quick and convenient way of switching the allocator to use TBB’s nifty thread-private heaps; see page 7 in this document)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)