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

new message #90

Merged
merged 26 commits into from
Mar 3, 2022
Merged

new message #90

merged 26 commits into from
Mar 3, 2022

Conversation

kotbegemot
Copy link
Member

No description provided.

static const auto CAPACITY_DECREASING_THRESHOLD = std::size_t{4};

std::size_t m_capacity = 0;
std::unique_ptr<std::int8_t[]> m_data;
Copy link

Choose a reason for hiding this comment

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

If std::int8_t turns out to be an alias for signed char instead of char (and on my system it is) there will be UB, because only char, unsigned char and std::byte are exceptions to the aliasing rules. I believe that std::uint8_t almost guaranteed to be an alias for char or unsigned char if you don't like to use char explicitly.

Copy link

Choose a reason for hiding this comment

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

Also, looks like you implemented std::vector. Maybe it's more appropriate to use it directly?

It might be awkward to implement accomodate using std::vector and would require unnecessary zeroing of memory, but might be worth consideration.

header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
std::int8_t* try_to_align(const T&) {
auto space_left = capacity() - volume();
void* creation_place = data() + volume();
auto aligned_place = std::align(alignof(T), sizeof(T), creation_place, space_left);
Copy link

Choose a reason for hiding this comment

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

I'm a little worried about calculating padding using two different ways: one manually in padded_size and the other here using std::align. But if they don't match, it's already big problem, so it's kinda okay?

header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
header/actor-zeta/detail/rtt_management.hpp Outdated Show resolved Hide resolved
header/actor-zeta/detail/rtt.hpp Outdated Show resolved Hide resolved
@kotbegemot kotbegemot added this to To do in Develop Dec 16, 2021
@kotbegemot kotbegemot moved this from To do to In progress in Develop Jan 5, 2022
@kotbegemot kotbegemot merged commit 4a5a1d4 into develop Mar 3, 2022
Develop automation moved this from In progress to Done Mar 3, 2022
@kotbegemot kotbegemot deleted the new-msg branch March 3, 2022 12:39
@kotbegemot kotbegemot added this to the 1.0.0a7 milestone Apr 4, 2022
kotbegemot added a commit that referenced this pull request May 2, 2022
* giving up a std::any
#98

Co-authored-by: gremsnoort <grem_snoort@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants