Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storeChunk: Add an overload for shared_ptr<T[]> #1296

Merged
merged 4 commits into from
Aug 16, 2022

Conversation

franzpoeschel
Copy link
Contributor

Noticed while working on #1294: With C++17, if you use shared_ptr<T[]>, it will automatically select the right destructor, i.e. delete[].
Note that our old version of storeChunk<>() already supports this more or less on accident, since we use std::decay inside determineDatatype then cast the shared_ptr down to void type. With giving this an explicit overload, we make the support more explicit to the user and also to ourselves, so we don't accidentally break this functionality in future.

@franzpoeschel franzpoeschel added frontend: C++17 api: new additions to the API labels Jun 28, 2022
@franzpoeschel
Copy link
Contributor Author

Clang-6 with libcpp does not seem to know about this? We can revert the examples and tests again and just leave the overload?

@franzpoeschel franzpoeschel force-pushed the add-shared-ptr-of-array-overload branch from 592c298 to 34a9d6f Compare July 19, 2022 08:49
@franzpoeschel franzpoeschel force-pushed the add-shared-ptr-of-array-overload branch from 34a9d6f to 339dc1d Compare July 29, 2022 10:01
@franzpoeschel franzpoeschel force-pushed the add-shared-ptr-of-array-overload branch from 339dc1d to 691cfdf Compare August 15, 2022 08:30
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++17 ftw :)

@ax3l ax3l merged commit 597ba19 into openPMD:dev Aug 16, 2022
@franzpoeschel franzpoeschel mentioned this pull request Oct 13, 2022
4 tasks
eschnett added a commit to eschnett/openPMD-api that referenced this pull request Nov 11, 2022
* dev: (70 commits)
  Docs: Recommend Static Build for Superbuilds (openPMD#1325)
  Python 3.11 (openPMD#1323)
  pybind11: v2.10.1+ (openPMD#1322)
  Add Attribute::getOptional<T>() and use to add some more dynamic datatype conversions at read time (openPMD#1278)
  Mapping between ADIOS steps and openPMD iterations (openPMD#949)
  Deprecate shareRaw (openPMD#1229)
  Fix append mode double attributes (openPMD#1302)
  Constant scalars: Don't flush double (openPMD#1315)
  Remove caching cmake vars (openPMD#1313)
  [pre-commit.ci] pre-commit autoupdate (openPMD#1311)
  storeChunk: Add an overload for shared_ptr<T[]> (openPMD#1296)
  Fix `operationAsString` Export (openPMD#1309)
  ADIOS2: more fine-grained control for file endings (openPMD#1218)
  [pre-commit.ci] pre-commit autoupdate (openPMD#1307)
  Fix file existence check in parallel tests (openPMD#1303)
  ADIOS2: Flush to disk within a step (openPMD#1207)
  [pre-commit.ci] pre-commit autoupdate (openPMD#1304)
  [pre-commit.ci] pre-commit autoupdate (openPMD#1295)
  Update catch2 to v2.13.9 (openPMD#1299)
  [pre-commit.ci] pre-commit autoupdate (openPMD#1292)
  ...

# Conflicts:
#	.github/workflows/linux.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: new additions to the API frontend: C++17
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants