Skip to content
New issue

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

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

Already on GitHub? # to your account

Support cloned values #50

Open
Proximyst opened this issue Nov 24, 2020 · 1 comment
Open

Support cloned values #50

Proximyst opened this issue Nov 24, 2020 · 1 comment

Comments

@Proximyst
Copy link

It'd be a great addition if we could generate values and have them cloned:

// This is day 2, 2019
#[aoc_generator(day2)]
pub fn gen(input: &str) -> Vec<isize> {
    input
        .split(",")
        .map(|s| s.trim())
        .flat_map(|s| s.parse::<isize>())
        .collect()
}

#[aoc(day2, part1)]
#[clone]
pub fn day2_impl1(input: Vec<isize>) -> isize {
    unimplemented!()
}
@ThomasdenH
Copy link

This should be timed in the benchmark as well, shouldn't it? If so, I'm not sure this is an improvement over just using let input = input.clone() on the first line.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants