April 25, 2025Apr 25 In this article, weâll see details of std::mdspan, a new view type tailored to multidimensional data. Weâll go through type declaration, creation techniques, and options to customize the internal functionality. Details of std::mdspan from C++23 by Bartlomiej Filipek From the article: In this article, weâll see details of std::mdspan, a new view type tailored to multidimensional data. Weâll go through type declaration, creation techniques, and options to customize the internal functionality. Type declaration The type is declared in the following way: template< class T, class Extents, class LayoutPolicy = std::layout_right, class AccessorPolicy = std::default_accessor<T> > class mdspan; And it has its own header <mdspan>. The main proposal for this feature can be found at https://wg21.link/P0009 Following the pattern from std::span, we have a few options to create mdspan: with dynamic or static extent. The key difference is that rather than just one dimension, we can specify multiple. The declaration also gives more options in the form of LayoutPolicy and AccessorPolicy. More on that later. View the full article
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.