Remove use of `std::aligned_storage` in any.hpp by nyibbang · Pull Request #1061 · BehaviorTree/BehaviorTree.CPP · GitHub
Skip to content

Remove use of std::aligned_storage in any.hpp#1061

Merged
facontidavide merged 1 commit into
BehaviorTree:masterfrom
nyibbang:feat/remove_deprecated_aligned_storage
Feb 1, 2026
Merged

Remove use of std::aligned_storage in any.hpp#1061
facontidavide merged 1 commit into
BehaviorTree:masterfrom
nyibbang:feat/remove_deprecated_aligned_storage

Conversation

@nyibbang

@nyibbang nyibbang commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Summary

This change removes the use of the std::aligned_storage type in contrib/any.hpp and replaces it with a struct with an explicit alignment requirement inheriting an array of bytes of the right size.

Motivation

The std::aligned_storage type has been deprecated in C++23, which may cause warnings in client code using the any.hpp header directly or indirectly.

References for this change are this stackoverflow discussion and the paper P1413R3 that suggested the deprecation.

In that paper, the suggested change is the following:

- std::aligned_storage_t<sizeof(T), alignof(T)> t_buff;
+ alignas(T) std::byte t_buff[sizeof(T)];

However in the context of the library and its clang-tidy rules (in this case, modernize-* rules) generate a warning with C-arrays and advise using a std::array instead.

Impacts on API / ABI

There is no impact on API, and as far as I know it should be ABI compatible.

Summary by CodeRabbit

  • Refactor
    • Improved internal storage implementation to enhance memory alignment handling.

✏️ Tip: You can customize this high-level summary in your review settings.

The type has been deprecated in C++23, which may cause warnings in
client code using this header.
@coderabbitai

coderabbitai Bot commented Jan 21, 2026

Copy link
Copy Markdown

@facontidavide facontidavide merged commit e0e6def into BehaviorTree:master Feb 1, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants