Skip to content

Use a hashmap instead of comparing strings with strcmp #2

@Chronophylos

Description

@Chronophylos

Using a hashmap like

std::unordered_map<std::string, std::function<int(char** argv, int argc, std::string fileName)> fn>

is a lot more performant than comparing strings with strcmp in a giant if-else-block.

Or a more simple solution

enum Functions { Open, Close, Write \* ... *\ };
std::unordered_map<std::string, Function> function_map;

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