Skip to content

do not depend on lifetime of user object in TokenList #424

Open
@firewave

Description

@firewave

TokenList depends on a mutable std::vector<std::string> object which holds the files of files which have been tokenized. This seems dangerous as it ties to the lifetime of another object. In some cases this vector is not even necessary to be owned by the user since it is not used outside of the TokenList. It looks the list this could just be owned by TokenList

This supported by the fact that the copy constructors and assignment operators copy the reference which means that two different instances will modify that "global" vector which is obviously wrong and will cause issues.

There was some usage which provides the input file via that vector parameter instead of (or additionally) to the filename parameter. This allows to tokenize multiples explicitly but I am not sure if that is even necessary. This might have contributed to the assumption that it is necessary to provide that vector.

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