MCPcopy Create free account
hub / github.com/ashvardanian/less_slow.cpp / aligned_array

Method aligned_array

less_slow.cpp:404–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402
403 public:
404 aligned_array(std::size_t size, std::size_t alignment = 64) : size_(size), alignment_(alignment) {
405 // With `std::aligned_alloc` in C++17, an exception won't be raised, which may be preferred in
406 // some environments. MSVC was late to adopt it, and developers would often use a combination
407 // of lower-level `posix_memalign` and `_aligned_malloc`/`_aligned_free` across Unix and Windows.
408 data_ = (type_ *)::operator new(sizeof(type_) * size_, std::align_val_t(alignment_));
409 }
410 ~aligned_array() noexcept { ::operator delete(data_, sizeof(type_) * size_, std::align_val_t(alignment_)); }
411
412 aligned_array(aligned_array const &) = delete;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected