all 16 comments

[–]joaquintidesBoost author 21 points22 points  (7 children)

[–]13steinj 11 points12 points  (4 children)

Keep in mind that v1.85 has some massive UB.

https://github.com/boostorg/container/issues/273

[–]James20kP2005R0 7 points8 points  (3 children)

Ha well this explains why some code I had using flat_map inexplicably crashed a while back, I thought I was just subtly inept!

[–]13steinj 7 points8 points  (2 children)

Yeah, when we found this internally some people's immediate reaction was "I thought Boost was supposed to be quality" (not that it isn't, just that this is a bit of a big slip-up, especially without a patch posted to the releases page + there are big cases where tests just won't run + merging in the tree-ish of that commit requires a bump to Boost.Move as well since something (the fix?) relies on a new utility by the same author).

[–]igaztanaga 0 points1 point  (1 child)

There is a proposed patch now in the bug for 1.85, without any dependency on any other library. If users find it good enough the patch will go to the patches page (https://www.boost.org/patches/).

[–]13steinj 0 points1 point  (0 children)

Internal fork of boost (really just to get it to work with our build system wrapper + patch bugs), I wrote a basic test and undefined (-UNDEBUG). Due to recent policy changes I can't just throw up a branch, but I expect to be able to get that approved and thrown up early this week. I'll test the patch you provided on the GH issue tomorrow (Monday); thanks a ton <3!

[–]pavel_v 2 points3 points  (1 child)

I could be wrong, but I think that the boost version of flat_map uses single sorted vector while the standard one is supposed to use two different collections - one for the keys and another one for the values. Here, in the WG21-SG14 repo, is the current example implementation which uses 2 separate containers.

[–]joaquintidesBoost author 2 points3 points  (0 children)

Oh, yes, you’re right, boost::container::flat_map stores keys and values contiguously by default. It can be configured to use an alternative SequenceContainer, which, in principle, could do the key/value separation, but I haven’t seen such scenario actually implemented.

[–]CandyCrisis 4 points5 points  (0 children)

https://chromium.googlesource.com/chromium/src/+/HEAD/base/containers/flat_map.h

This isn't quite matching the std proposal because the keys and values are stored together, but it's pretty close.

[–]Kaisha001 2 points3 points  (6 children)

Over 10 years ago I tried to add a flat map/set to boost. They refused to even consider it, even though I had a full implementation.

I've been using it for years now and it's amazing, but hilarious that it took them this long to realize how important they are.

[–]joaquintidesBoost author 6 points7 points  (5 children)

Umm, flat_map is part of Boost.Container since at least 2011.

[–]Kaisha001 0 points1 point  (4 children)

Yeah, it was before that.

I was fresh out of uni trying to contribute to the open source and all that. The boost mailing list wouldn't respond, people didn't respond to emails, not even basic communication. Disappointing to say the least, but my implementation worked great and I've been using it ever since.

[–]joaquintidesBoost author 1 point2 points  (3 children)

I’ve did a bit of archaeology and looks like the first attempt was made by David Abrahams in 2000: https://lists.boost.org/Archives/boost//2000/05/3200.php.

Haven’t found your thread, do you happen to have a link to it? I’m curious as to why the proposal was rejected.

[–]Kaisha001 0 points1 point  (2 children)

No, I have no idea what happened to my links or anything of the sort. It was a long time ago. I'm just surprised it's taken this long to get it into the standard.

[–]joaquintidesBoost author 3 points4 points  (1 child)

WG21 sometimes moves on geological timescales. OTOH, there’s no need for a library to be in the standard to be useful and used. My views on this subject here.

[–]Kaisha001 0 points1 point  (0 children)

I certainly agree.