Получить индексы в C++ mdspan из ссылки с помощью арифметикиC++

Программы на C++. Форум разработчиков
Гость
Получить индексы в C++ mdspan из ссылки с помощью арифметики

Сообщение Гость »

#include
#include
#include
#include
#include

int main(){
std::vector vec = {1, 2, 3, 4, 5, 6, 7, 88, 9, 10, 11, 12};
auto ms = std::mdspan(vec.data(), 2, 6);

//given the indices in the tensor, get the position in contiguous memory
{
const int position = std::distance(vec.data(), &ms[1, 3]);
std::cout

Подробнее здесь: https://stackoverflow.com/questions/781 ... arithmetic

Вернуться в «C++»