Skip to content

Code quality: Repeated branch in conditional chain #388

Open
@krishnakumarg1984

Description

@krishnakumarg1984

In sopt/cpp/chained_operators.h, we have

    if (funcs.size() == 1)
      (*first)(output, input);
    else if (funcs.size() % 2 == 1)
      (*first)(output, input);
    else {
      (*first)(*buffer, input);
      first++;
      (*first)(output, *buffer);
    }

As we can see, the if statement and the elseif has the same statement in their bodies. This can be cleaned up to get rid of the redundancy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions