Skip to content

Commit f4526a3

Browse files
author
David Roberts
authored
[7.x][ML] Work around compile error in old Xcode (#700)
The problem is described in https://stackoverflow.com/questions/7411515/why-does-c-require-a-user-provided-default-constructor-to-default-construct-a Moving construction of the hasher object into the checksum method won't matter in practice as the constructor is a no-op and the object has no data members, so it should get completely optimised away. Backport of #699
1 parent 1becee7 commit f4526a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/core/CLoopProgress.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const std::string LOOP_SIZE_TAG{"loop_size_tag"};
2222
const std::string PROGRESS_STEPS_TAG{"progress_steps_tag"};
2323
const std::string CURRENT_STEP_PROGRESS_TAG{"current_step_progress_tag"};
2424
const std::string LOOP_POS_TAG{"loop_pos_tag"};
25-
const std::hash<std::string> stringHasher;
2625
}
2726

2827
CLoopProgress::CLoopProgress()
@@ -59,6 +58,7 @@ void CLoopProgress::resumeRestored() {
5958
std::uint64_t CLoopProgress::checksum() const {
6059
std::uint64_t seed{core::CHashing::hashCombine(
6160
static_cast<std::uint64_t>(m_Size), static_cast<std::uint64_t>(m_Steps))};
61+
std::hash<std::string> stringHasher;
6262
seed = core::CHashing::hashCombine(
6363
seed, stringHasher(core::CStringUtils::typeToStringPrecise(
6464
m_StepProgress, core::CIEEE754::E_DoublePrecision)));

0 commit comments

Comments
 (0)