#include#include int main() { boost::array arr = {1, 2, 3, 4, 5}; int& ref = boost::get<2>(arr); std::cout << ref << std::endl; return 0; }
#includeIn this example, we get the pointer of the first element of the array using the get function and store it in a pointer variable ptr. We then dereference the pointer and print the value, which should be 1. Both examples use the CArrRef get function from the Boost library.#include int main() { boost::array arr = {1, 2, 3, 4, 5}; int* ptr = boost::get (&arr[0]); std::cout << *ptr << std::endl; return 0; }