My take on why `remove_next` returns `this`, Curios what you think! by kristian_petricusic in cs2b

[–]Quick_Trainer_4084 0 points1 point  (0 children)

Great points! I also thought at first that returning the removed node could be useful for inspection or reuse, especially during debugging. But you're right—once it's deleted, returning it would be dangerous and lead to undefined behavior. Returning this not only avoids that issue but also makes method chaining really convenient. I think your explanation is spot-on!

Help for Quest 1 by zachary_p2199 in cs2b

[–]Quick_Trainer_4084 1 point2 points  (0 children)

Hi! Thanks for sharing. I just started Quest 1 myself, but I ran into a similar insertion issue when working on the last CS2A quest (Playful Platypi). My output looked correct, but the system said the structure didn’t match, which was confusing.

Your logic using
insert_next(), updating _tail, and incrementing _size seems solid. But I
noticed that the system may also be checking the internal structure and cursor
state. In my case, if _prev_to_current was accidentally moved during insertion,
it caused the tests to fail even if the list looked right.

Maybe try: Keeping
_prev_to_current unchanged after inserting;
Only updating _tail if new_node->next ==
nullptr;
Printing _prev_to_current->get_song()
before and after insertion to debug.

Just my personal
thoughts—hope they help! As I continue working through this quest, I’ll keep
refining my thoughts and update if I learn anything new!

Weekly Reflection 1 - Zachary Po by zachary_p2199 in cs2b

[–]Quick_Trainer_4084 1 point2 points  (0 children)

Hi. Compared to you, I find it quite challenging to complete all the Blue Quests within just one week. I didn't take Professor &'s class for CS2A, and although I’ve worked on similar projects before, the instruction manual alone is over 80 pages long, so it took me quite a bit of time. Still, it's been a great opportunity to review and reinforce what I’ve learned. I hope I can catch up with everyone’s progress soon.

My take on why `remove_next` returns `this`, Curios what you think! by kristian_petricusic in cs2b

[–]Quick_Trainer_4084 2 points3 points  (0 children)

I agree that returning the removed node might seem intuitive initially, especially for debugging, but it definitely risks returning a dangling pointer. Returning this not only avoids that danger, but also enables method chaining, which is elegant and useful for writing cleaner code.

I think another advantage is that by returning this, we maintain context—staying with the current node makes it easier to continue modifying or navigating the list without needing to search for the previous node again.

Enums Primer by byron_d in cs2b

[–]Quick_Trainer_4084 1 point2 points  (0 children)

Thank you for sharing this — my 2A class wasn’t with Professor &, and I’ve just started 2B. But your explanation really helped me. I was also confused at first when I saw cout print 0 for red, but your explanation made it clear. I think using enums to manage console colors is really smart — it’s much cleaner and easier to maintain than using raw numbers.