Modify

Opened 23 months ago

Closed 14 months ago

Last modified 14 months 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@… 23 months ago.

Download all attachments as: .zip

Change History (9)

Changed 23 months ago by mm-info@…

Attachment: test.cc added

comment:1 Changed 23 months ago by mm-info@…

Version 1.58 works as expected.

comment:2 Changed 23 months ago by Benny Nielsen <mm-info@…>

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

comment:3 Changed 22 months ago by viboes

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 Changed 21 months ago by Ion Gaztañaga

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 Changed 21 months ago by Benny Nielsen <mm-info@…>

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 Changed 21 months ago by Benny Nielsen <mm-info@…>

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 Changed 14 months ago by Ion Gaztañaga

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 Changed 14 months ago by mm-info@…

Awesome! Thanks.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.