Skip to content

Fix stdlib interop#31

Open
detri wants to merge 2 commits into
gharveymn:mainfrom
detri:fix-stdlib-interop
Open

Fix stdlib interop#31
detri wants to merge 2 commits into
gharveymn:mainfrom
detri:fix-stdlib-interop

Conversation

@detri
Copy link
Copy Markdown

@detri detri commented Apr 28, 2026

Hi, thanks for writing and publishing this awesome container. It's my preferred implementation of a vector with inline capacity.

I noticed some issues with conditions gated behind GCH_STDLIB_INTEROP that prevent compilation when enabled. I decided to fix them and write a test to confirm. I hope this is useful, it was for me lol.

I didn't see any contribution guidelines, so I just tried to match the existing style and pointed my changes at main.

Let me know if you need any changes. I did run tests locally, but only for C++23.

Copy link
Copy Markdown
Owner

@gharveymn gharveymn left a comment

Choose a reason for hiding this comment

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

Thanks for the valuable contribution! That was a bad oversight, so thanks for the unit test. Just a couple comments, but it looks pretty much good!

Comment thread source/include/gch/small_vector.hpp
Comment on lines +28 to +32
const std::valarray<int> src_val { 9, 10, 11, 12 };
gch::small_vector<int, 2> from_val;
from_val.assign (std::begin (src_val), std::end (src_val));
CHECK (from_val.size () == src_val.size ());
CHECK (std::equal (std::begin (src_val), std::end (src_val), from_val.begin ()));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think std::valarray is the reason we can't test under constexpr here, but we should be able to test with std::vector and std::array. Perhaps we split them into files test-interop-array.cpp, test-interop-vector.cpp, test-interop-valarray.cpp, and only disable constexpr for test-interop-valarray.cpp?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed, I'll give that a shot. Sorry it took so long to get back to this, life caught up with me.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

No worries, life happens! If that doesn't work, could you rename this file to like test-std-interop.cpp or something? I'm not even nitpicking; it's because for some reason CLion has a bug or something and the targets don't show up with this file name (??? it's literally just when I have it as test-interop.cpp haha).

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