I’ve been trying to solve the problem BST Operations (BSTOPS) (for a year almost XD ). It passes the sample testcase. Can someone please find me a testcase for which my solution fails? Here’s the code with the necessary explanations in comments. Since this is my first time using smart pointers, can someone also suggest some ways to improve my design?
How do I convert a std::unique_ptr into a std::experimental::observer_ptr in a better way? I’m currently doing it this way.
Honestly, while it’s great that you’re learning about the bleeding-edge of C++, I’d recommend just ditching observer_ptr - it seems to give a huge decrease in clarity for (very) minimal gains
Edit:
To answer the question you asked: no, I don’t see any better way of doing this, given the very restricted set of constructors for std::observer_ptr:
I got rid of the mess I’ve made with the std::experimental::observer_ptrs and replaced them with raw pointers here. However, my submission is still fetching me a WA.
We’ve fixed the test cases, and also improved the statements a bit. Please let me know if there are other issues with this problem. Here is a link to my submission: link.
The submissions which gave AC previously shall give WA now, if submitted again, as the test files have been modified.