Skip to content

Additional edge test in max-of-vector needed #242

Description

@mariuszlisowski

Test against the edge case when the vector is empty. Could be useful when std::max_element() is used form algorithm header and dereferencing its result could cause segmentation fault.

If iterative solution is used, when nothing is found then std::numeric_limits::min() may be returned if defined.
Similarly if max is initialized with the first element of a vector - SegFault.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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