Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

"Expression: sequence not ordered" in debug mode #12

@tomysshadow

Description

@tomysshadow

This library works in Release builds, however in a Debug build it triggers the following assertion:

sequence not ordered

The error occurs when I create the SteamAppPathProvider object:

SteamAppPathProvider steamAppPathProvider;

and specifically on the following line:

    bool basicIncludeCompare(std::string::const_iterator start, std::string_view comp)
    {
        return std::includes(start, start+comp.length(), comp.cbegin(), comp.cend());
    }

This assertion seems to trigger in order to warn about undefined behaviour. From cppreference:

If [first1, last1) or [first2, last2) is not sorted with respect to comp, the behavior is undefined.

This doesn't seem trivial to fix because it looks like std::sort would need to be used on the ranges in order to make them valid for std::includes, but both of them are const so they cannot be modified. All of the iterators passed to this function would need to be made mutable (or alternatively - a different comparison method could be used, as it is probably not worth the hassle for what is effectively a strcmp??)

Visual Studio 2019. The issue occurs regardless of if I compile with /std:c++20 or /std:c++latest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions