Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Please replace if by if constexpr for C++ 17 and above #1087

Open
@SergeyKorytnik

Description

@SergeyKorytnik

The following if statements should be if constexpr in C++17 and above:

if (std::is_integral<OutT>::value) {

if (!std::is_same<T,bool>::value && std::is_integral<T>::value) {

if (std::is_floating_point<T>::value) {

if (sizeof(in_value) >sizeof(double)) {

}elseif (sizeof(in_value) >sizeof(float)) {

and not as trivial but constexpr parts from the following if statements should be extracted in separate if constexpr statements:
if (std::is_integral<T>::value && std::is_floating_point<OutT>::value &&

}elseif (std::is_floating_point<T>::value &&

This way compiler warnings like

WarningC4804'<': unsafe use of type 'bool' in operation

can be avoided in line

if (in_value <kOutMin || in_value > std::numeric_limits<OutT>::max()) {

In template bool ConvertValue(AttributeValueIndex att_id, int8_t out_num_components, OutT *out_val) const
there is a long switch that "calls"/instantiates ConvertTypedValue<bool, OutT> that in turn "calls"
ConvertComponentValue<bool, OutT> that causes the warning for ConvertComponentValue<bool, float> because language requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp