Skip to content

Conversation

@jbab
Copy link
Collaborator

@jbab jbab commented Jan 30, 2025

No description provided.

if (std::is_same_v<T, NonTriviallyDefaultConstructible> ||
std::is_same_v<T, NonTrivial>) {
if constexpr (std::is_scalar_v<T> || std::is_aggregate_v<T> ||
!std::is_trivially_default_constructible_v<T>) {

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

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

ops, didnt see the negation.

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if this is actually better than std::is_same_v<T, NonTriviallyDefaultConstructible> || std::is_same_v<T, NonTrivial>, we can do the comparison here not because the underlying is a scalar or an aggregate, it is because we know it has a well defined value-initialization.

Comment on lines +87 to +103
using T = TestFixture::T;
using InputIterator = TestFixture::InputIterator;

IV a(InputIterator{0}, InputIterator{IV::max_size() / 2});
EXPECT_EQ(a.size(), IV::max_size() / 2);
if (!a.empty()) {
EXPECT_EQ(a.back().value, IV::max_size() / 2 - 1);
for (std::size_t n : {std::size_t(0), IV::max_size() / 2u, IV::max_size()}) {
// InputIterator
InputIterator::num_deref = 0u;
IV a(InputIterator{}, InputIterator{static_cast<int>(n)});
EXPECT_EQ(a.size(), n);
for (int i = 0; i < static_cast<int>(n); ++i) {
EXPECT_EQ(a[i], T{i});
}
// Only single-pass through input range
EXPECT_EQ(InputIterator::num_deref, n);

// RandomAccessIterator
IV b(a.begin(), a.end());
EXPECT_EQ(b, a);
Copy link
Member

Choose a reason for hiding this comment

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

This is really helpful, thanks!

Copy link
Member

@DeveloperPaul123 DeveloperPaul123 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Nice work 👍

@JeffGarland
Copy link
Member

@jbab this looks like it's been complete for awhile. I'm going to merge it in the next 24 hours unless there's still something to do here.

@wusatosi wusatosi merged commit 97b10de into main May 8, 2025
34 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.

5 participants