Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK-m VTK-m
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 205
    • Issues 205
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 36
    • Merge requests 36
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTKVTK
  • VTK-mVTK-m
  • Merge requests
  • !2568

Allow ArrayCopy into const ref of UnknownArrayHandle

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Kenneth Moreland requested to merge kmorel/vtk-m:array-copy-const-ref into master Sep 01, 2021
  • Overview 5
  • Commits 1
  • Pipelines 2
  • Changes 2

Added the following form of ArrayCopy:

VTKM_CONT_EXPORT void ArrayCopy(
  const vtkm::cont::UnknownArrayHandle& source,
  const vtkm::cont::UnknownArrayHandle& destination);

Note that the destination array is a constant reference. This is actually OK because you can change the contents of an UnknownArrayHandle (as long as you don't change the array being referenced). The main motivation for this change is to allow you to call this form of ArrayCopy while passing in a ArrayHandle as the second argument. C++ will automatically make the conversion, but the function has to accept a const reference for it to be passed correctly.

Note that there is still a form of ArrayCopy that accepts a non-const reference to the destination array. The two arrays behave the same except for one difference. For the non-const version, if the UnknownArrayHandle does not already point to an array (i.e. is not valid), a new array will be created and placed in the destination object. However, because this cannot be done for a const reference, an exception is thrown instead.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: array-copy-const-ref