Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add copy constructors and/or move semantics to support modern C++ auto expresions #50

Open
weegreenblobbie opened this issue Nov 30, 2017 · 2 comments
Assignees

Comments

@weegreenblobbie
Copy link

weegreenblobbie commented Nov 30, 2017

I'd love to write this:

    auto parser = args::ArgumentParser(
        "Benchmark a BFS graph search on a knureon complex"
    );

    auto help = args::HelpFlag(
        parser,
        "help",
        "Display this help menu",
        {'h', "help"}
    );

    auto args::ValueFlag<uint32_t>(
        parser,
        "seed",
        "The seed to initialize the random number generator",
        {"seed"}
    );

    auto scale = args::ValueFlag<uint32_t>(
        parser,
        "scale",
        "The logarithm base two of the number of vertices",
        {'s', "scale"}
    );

    auto edgefactor = args::ValueFlag<uint32_t>(
        parser,
        "edgefactor",
        "The ratio of the graph’s edge count to its vertex count",
        {'e', "edgefactor"}
    );

as I find it easier to read and encourages the use of auto everywhere.

@Taywee
Copy link
Owner

Taywee commented Nov 30, 2017

I agree entirely (at the very least, it should be available). This should be doable without breaking BC. I think it probably makes more sense to have the factories live on the parser, though, more like

auto parser = args::ArgumentParser(
    "Benchmark a BFS graph search on a knureon complex"
);

auto help = parser.HelpFlag(
    "help",
    "Display this help menu",
    {'h', "help"}
);

auto seed = parser.ValueFlag<uint32_t>(
    "seed",
    "The seed to initialize the random number generator",
    {"seed"}
);

@weegreenblobbie
Copy link
Author

Nice!

@Taywee Taywee self-assigned this Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants