예제 #1
0
TEST(AlignedAllocatorTest, AllocatorAlign)
{
    AlignedAllocator<real>   a;
    real *                   p    = a.allocate(1000);

    // Mask for 128-byte alignment is 128-1 - these bits should be zero in p
    std::size_t              mask = static_cast<std::size_t>(128-1);

    EXPECT_EQ(0, reinterpret_cast<std::size_t>(p) & mask);
    a.deallocate(p, 1000);
}
예제 #2
0
	// msvc 14.10.25017 (VC++ 2017 March release) fails with an internal error with conditional noexcept
//	~aligned_ptr() noexcept(std::is_nothrow_destructible_v<value_type>) {}
	~aligned_padded_ptr() noexcept {
		if (ptr) {
			deleter(ptr);
			allocator.deallocate(reinterpret_cast<std::uint8_t*>(ptr), block_size);
		}
	}