day_23/AoC_2020_23.cpp
cup* add_cup_after(cup* after, cup_finder& f, int label)
{
    auto new_cup = new cup(label);
    if (after)
    {
        new_cup->next = after->next;
        after->next = new_cup;
    }
    f.cup_by_value[label] = new_cup;
    return new_cup;
}
// Add a cup with the given label after the given cup,
// maintaining the circular list. Works even if the
// after-cup is null, to create the first cup.
// Add it to the cup finder, too.
Add a cup with the given label after the given cup,
maintaining the circular list. Works even if the
after-cup is null, to create the first cup.
Add it to the cup finder, too.
Add a cup with the given label after the given cup maintaining the circular list . Works even if the after - cup is null to create the first cup . Add it to the cup finder too .
cup* add_cup_after(cup* after, cup_finder& f, int label)
{
    auto new_cup = new cup(label);
    if (after)
    {
        new_cup->next = after->next;
        after->next = new_cup;
    }
    f.cup_by_value[label] = new_cup;
    return new_cup;
}
cup * add_cup_after ( cup * after , cup_finder & f , int label ) { auto new_cup = new cup ( label ) ; if ( after ) { new_cup -> next = after -> next ; after -> next = new_cup ; } f . cup_by_value [ label ] = new_cup ; return new_cup ; }
Add a cup with the given label after the given cup,
maintaining the circular list.
Add a cup with the given label after the given cup maintaining the circular list .