Closed DJuego closed 6 years ago
Resolved! 😃 I have found the solution in Stack Overflow
It is proposed the next modification:
struct decreasing_order_comparator {
bool operator() (const std::pair<uint64_t, Item>& lhs, const std::pair<uint64_t, Item>& rhs) const
{
return (lhs.first > rhs.first) or (not(lhs.first > rhs.first) and lhs.second < rhs.second);
}
}:
to:
struct decreasing_order_comparator {
bool operator() (const std::pair<uint64_t, Item>& lhs, const std::pair<uint64_t, Item>& rhs) const
{
return std::tie(lhs) < std::tie(rhs);
}
};
Another alternative:
struct decreasing_order_comparator {
bool operator() (const std::pair<uint64_t, Item>& lhs, const std::pair<uint64_t, Item>& rhs) const
{
if (lhs.first != rhs.first)
{
return (lhs.first > rhs.first);
}
return (lhs.second < rhs.second);
}
};
@integeruser , I suggest you study this fix, and if it seems right, make the change. The official tests are successfully passed in Visual Studio 2017 and gcc 7.3.0 (MinGW).
With this change, your FP-growth implementation would achieve compatibility with Visual Studio 2017 (at least).
DJuego
Again, thanks for reporting and investigating, this should be fixed now. Feel free to reopen the issue if something's still wrong.
Well. Now I want to run the sample with Visual Studio 2017 (15.6.2) in "Debug" mode. Do not work.
I isolated the problem:
When i run:
I get: " Debug Assertion Failed! Program: C:\Windows\SYSTEM32\MSVCP140D.dll File: c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.13.26128\include\xtree Line: 1744 Expression: invalid comparator "
On the other hand, when i run the code In release mode the tests fail:For example:test 1: 19 patterns are expected. 13 are obtained.My bad. The tests failed because i had modified the comparison. Sorry.
to
The assert problem seems related with: lhs.second < rhs.second
Sorry again.
Yes. In release mode it seems that the tests are successfully passed (assert does not work in release mode).
DJuego