This is an example of how to use offset_pointer.
#include <iostream>
{
int *array =
static_cast<int *
>(
manager.allocate(10 *
sizeof(
int)));
array[0] = 1;
array[1] = 2;
[[maybe_unused]] int_offset_prt *ptr =
manager.construct<int_offset_prt>(
"ptr")(array);
}
{
int_offset_prt *ptr =
manager.find<int_offset_prt>(
"ptr").first;
int *array = metall::to_raw_pointer(*ptr);
std::cout << array[0] << std::endl;
std::cout << array[1] << std::endl;
manager.deallocate(metall::to_raw_pointer(*ptr));
*ptr = nullptr;
manager.destroy<int_offset_prt>(
"ptr");
}
return 0;
}
int main()
Definition: jgraph.cpp:24