Opened 10 years ago
Closed 10 years ago
#8129 closed Bugs (fixed)
Conversion warning in hashed_index.hpp
Reported by: | Owned by: | Joaquín M López Muñoz | |
---|---|---|---|
Milestone: | To Be Determined | Component: | multi_index |
Version: | Boost Development Trunk | Severity: | Cosmetic |
Keywords: | Cc: |
Description
Hello,
I get a warning that conversion to 'float' from 'size_type' may alter its value when compiling the code ex.13.7.cpp (based on an example from The Boost C++ Libraries by Boris Schaeling) with -Wconversion. The attached file test.txt shows the compilation. The attached file diff.txt shows a change that fixed the problem for me. Thanks, and best wishes.
Brad Meyer
Attachments (3)
Change History (7)
by , 10 years ago
Attachment: | ex.13.7.cpp added |
---|
comment:1 by , 10 years ago
Version: | Boost 1.53.0 → Boost Development Trunk |
---|
follow-up: 3 comment:2 by , 10 years ago
Hi Brad,
Actually, your proposed patch is not entirely correct: n
should be promoted to a floating point type, not mlf
to integral. Please try the following:
float fbc=static_cast<float>(1+static_cast<double>(n)/mlf);
If this clears the warning I'll commit the change to the repository. Thank you.
comment:3 by , 10 years ago
Replying to joaquin:
Actually, your proposed patch is not entirely correct:
n
should be promoted to a floating point type, notmlf
to integral. Please try the following:float fbc=static_cast<float>(1+static_cast<double>(n)/mlf);If this clears the warning I'll commit the change to the repository. Thank you.
Hi,
Yes, this does clear the warning, and I do see that n
should be promoted, not mlf
. Thanks, and best wishes.
Brad
test cpp file