Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • __cplusplus User Group __cplusplus User Group
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • SDE
  • __cplusplus User Group__cplusplus User Group
  • Issues
  • #8

Closed
Open
Created Jul 13, 2021 by Matthias Kretz@mkretzMaintainer

std::span — getting rid of pointer and size

C++ does not support passing around variably sized arrays by value. The closest is to pass std::vector<T>. But you don't always have your data in the exact std::vector<T> chunks to make that a viable interface. So instead, we pass a pointer to the start of the array and an integer to tell the function how many elements after the pointer are valid array accesses. Example: you have a vector<int> data and want to pass the elements from index n to n+16 to a function. std::span abstracts this use case and integrates more or less into the APIs of the C++ standard library.

Edited Sep 22, 2021 by Matthias Kretz
Assignee
Assign to
Time tracking

https://git.gsi.de is provided by CIT-HPC | GSI Helmholtzzentrum fuer Schwerionenforschung GmbH | Imprint (in German) | Privacy policy