Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#11802 closed Bugs (fixed)

Incorrect ordering after using insert() with ordered_range_t on a flat_multiset with a non-default sort order

Reported by: mm-info@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.59.0 Severity: Regression
Keywords: Cc:

Description

The attached file is a simple example. A set is created with the number 0 and two insertions are performed afterwards. The first one works, but the second one fails. The second one uses ordered_range_t.

This worked in earlier releases of Boost. I'm not sure when it failed to work, but I think I updated from 1.55 to 1.59.

Attachments (1)

test.cc (545 bytes ) - added by mm-info@… 7 years ago.

Download all attachments as: .zip

Change History (9)

by mm-info@…, 7 years ago

Attachment: test.cc added

comment:1 by mm-info@…, 7 years ago

Version 1.58 works as expected.

comment:2 by Benny Nielsen <mm-info@…>, 7 years ago

Clarification: My example is using flat_multiset although the title states flat_set. (I haven't actually tried anything but flat_multiset.)

comment:3 by viboes, 7 years ago

Summary: Incorrect ordering after using insert() with ordered_range_t on a flat_set with a non-default sort orderIncorrect ordering after using insert() with ordered_range_t on a flat_multiset with a non-default sort order

comment:4 by Ion Gaztañaga, 7 years ago

The error should be fixed in recently released Boost 1.60, in my tests your example passes fine. Could you please check if that's the problem is fixed for you?

comment:5 by Benny Nielsen <mm-info@…>, 7 years ago

I cannot confirm this fixes it for me. Neither in my primary use or in the example provided. Maybe it's compiler related. I'm on OS X:

> clang++ -std=c++11 -I/path/to/boost_1_60_0/ test.cc && ./a.out
Assertion failed: (*values.begin() == 1), function main, file test.cc, line 15.

> clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

As previously noted it works with 1.58. It fails with both 1.59 and 1.60.

comment:6 by Benny Nielsen <mm-info@…>, 7 years ago

In case this helps, I can make it work by reverting flat_tree.hpp to the version used in 1.58. The main difference appears to be that ordered insertion is now handled by merge_unique in the vector class. I took a quick look at that and was a bit worried about this comment for a subfunction:

 //Absolutely experimental. This function might change, disappear or simply crash!

comment:7 by Ion Gaztañaga, 6 years ago

Resolution: fixed
Status: newclosed

Reviewing old bugs that were forgotten. The error was reproduced and the following commit fixes it:

https://github.com/boostorg/container/commit/d5adae2edadbb43f78dcfcb21bd4792a8876f6f0

Many thanks for your report and patience.

comment:8 by mm-info@…, 6 years ago

Awesome! Thanks.

Note: See TracTickets for help on using tickets.