Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Assertion error on boost::unordered_set (and probably in stl unordered set).

75 views
Skip to first unread message

Evan Sebastian

unread,
Oct 16, 2014, 12:28:45 PM10/16/14
to
Hello,

Have someone encountered the assertion error when working with boost unordered_set (and set)?

The value type used is std::int64_t
The assertion which fails is

mlf >= minimum max load factor

Which is the first statement in the function min_buckets_for_size in this header file.

http://www.boost.org/doc/libs/1_50_0/boost/unordered/detail/table.hpp


Details :
I have two projects in Visual C++ 2013 (x86), one for library and one for native unit testing as per usual.

In the project, there is a class that defines some resource When I changed one of its member's type from vector to unordered_set (and fixed the regression it caused until it builds fine), my unit testing project failed to run with this message (https://connect.microsoft.com/VisualStudio/feedback/details/786792/c-unit-testing-failed-to-set-up-the-execution-context-to-run-the-test).


At first I used stl unordered set, so I tried changing to boost::unordered_set to see if that makes any difference. Then I get the assertion error.

In the code itself, the said member only undergo 1. initialization via C++11 initializer list, 2. comparison, 3. insertion.

The builds are fine, and the program executable doesn't show any unintended behavior.
Unfortunately, I can't show the complete code since this is a private project.

I would appreciate any help or suggestion on this problem.

------
Evan Sebastian

Öö Tiib

unread,
Oct 16, 2014, 1:13:08 PM10/16/14
to
On Thursday, 16 October 2014 19:28:45 UTC+3, Evan Sebastian wrote:
>
> Unfortunately, I can't show the complete code since this is a private project.

Try to make minimal example that reproduces the issue.
Constructing it typically reveals where the defect is in your private code.
If it does not for you then at least you can post that thing since it is
not complete code of your private project anymore.

Evan Sebastian

unread,
Oct 16, 2014, 2:02:49 PM10/16/14
to
Thanks for the suggestion, I already resolved the problem just now.

Turns out there is a there is a static public constant that is used before it is defined, thus the constant which contains unordered set stores nothing but garbage values.
0 new messages