Post AvRxSv8AcOqSMae036 by [email protected] | |
More posts by [email protected] | |
Post #AvRx4QuBLRgdfcQOUi by [email protected] | |
0 likes, 0 repeats | |
I find myself with the need for a std::vector-alike that embeds the capacity at… | |
Post #AvRx4R1ysRvQ3o4ceO by [email protected] | |
0 likes, 1 repeats | |
@TartanLlama No, because there's no way to find that address for the capaci… | |
Post #AvRxSv1n07k02neu6S by [email protected] | |
0 likes, 0 repeats | |
@dascandy you store the size as a member, just not the capacity. The capacity m… | |
Post #AvRxSv8AcOqSMae036 by [email protected] | |
0 likes, 1 repeats | |
@TartanLlama how is that advantageous over moving both size/capacity into the a… | |
Post #AvRy2KJ30amCZxcBFI by [email protected] | |
0 likes, 0 repeats | |
@dascandy I'm targeting an ABI where vector is (ptr,size) and want to lower… | |
Post #AvRy2KP4eBb4seQzdg by [email protected] | |
0 likes, 1 repeats | |
@TartanLlama Haven't seen it yet but seems useful for that interop. Is it w… | |
Post #AvRyKPifcYLoa3DyJk by [email protected] | |
0 likes, 0 repeats | |
@dascandy a bit of both: it's for generating C++ bindings from Wasm's c… | |
Post #AvRyKPohG9Agsk2mi8 by [email protected] | |
0 likes, 1 repeats | |
@TartanLlama Did you check with the people working on Rust-C++ interop already?… | |
Post #AvacAxsPK04B3HVW8O by [email protected] | |
0 likes, 0 repeats | |
Context: the Wasm component ABI passes vectors as (ptr,size). Since C++ vectors… | |
Post #AvacAxyQxat3LyKKWm by [email protected] | |
0 likes, 0 repeats | |
I have an implementation that maybe works? https://godbolt.org/z/PnPM39c7q | |
Post #AvacAy6aTHPPlG8qEi by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama If I understand your requirements correctly you could also still k… | |
Post #AvacAyCG8Bwi2qnN4q by [email protected] | |
0 likes, 0 repeats | |
@dotstdy Unfortunately I need to be able to hand off the buffer to code that is… | |
Post #AvacAzCIPXZN9Foum0 by [email protected] | |
0 likes, 0 repeats | |
I forget where the standard ended up with requiring std::launder here | |
Post #AvacBiM6Vv9ZChksoC by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama ah right of course, it's even written down in there :') | |
Post #AvacCKMnBoHb5qMy9o by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama You need to be careful with the provenance of pointers (here: refe… | |
Post #AvacCR7S5FAg2IFJia by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama how would it know the offset to the end of the allocated data unle… | |
Post #AvacCRDTipzYKz486y by [email protected] | |
0 likes, 0 repeats | |
@cliffordheath you store it just after the last element and move it around as y… | |
Post #AvacCRKZITfAgyNnA8 by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama @cliffordheath that's an extra cost per push. Could you do som… | |
Post #AvacCRQExOCSyZ2K0G by [email protected] | |
0 likes, 0 repeats | |
@JSAMcFarlane That was my initial approach, however I need to support releasing… | |
Post #AvacD8A63HpvWwoXJI by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama Are std::span not already simply (ptr, size) ? You could then pass… | |
Post #AvacD8GpeFDxrpxuoC by [email protected] | |
0 likes, 0 repeats | |
@thibault then you need storage to back the nested spans though | |
Post #AvacD8NZFCc0Cj7IJ6 by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama Yeah, but if you already have the vectors/arrays allocated somewhe… | |
Post #AvacD8TwrTiSWW6OFk by [email protected] | |
0 likes, 0 repeats | |
@thibault at the ABI interface, the top-level vector needs to become a single (… | |
Post #AvacDJCd0DOhlz5DHc by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama Ah, bummer. | |
Post #AvacDspqWOZ4HkhWls by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama (noob here) what is the exact difference between "size" … | |
Post #AvacDswa7Lx6cdquGm by [email protected] | |
0 likes, 0 repeats | |
@pierstoval `size` is the number of elements currently stored, `capacity` is th… | |
Post #AvacEH3qS01TQ7R2vI by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama Oh I see, thanks! | |
Post #AvacFBBvl7lTVPeIIi by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama that sounds neither difficult nor advantageous | |
Post #AvacFBHbQ2Iln0Ip8q by [email protected] | |
0 likes, 0 repeats | |
@cliffordheath I'm targeting an ABI where vector is (ptr,size) and want to … | |
Post #AvacFMwQ4cUHwmU4n2 by [email protected] | |
0 likes, 0 repeats | |
@TartanLlama yes, I see. I implemented immutable (cow) slices, so perhaps some … |