InputStream code no longer works on latest version of JUCE

After upgrading to the latest version of JUCE, my InputStream related code no longer works. I converted from InputStream * to std::unique_ptr based on the errors I was getting…

std::unique_ptr<InputStream> wi(url.createInputStream(false));
    if (wi != nullptr)
        std::unique_ptr<AudioFormatReader> reader = formatManager.createReaderFor(wi);

but now I’m getting an error saying “call to implicitly deleted copy constructor of ‘std::unique_ptr’” on the createReaderFor call.

The previous version of JUCE I was using was from May 2019. Any advice would be very welcome.

My advice would be to bisect to see which change on JUCE’s side triggers your error, then you’ll easily see how the JUCE api changed and how you need to maintain your code accordingly

This is a misuse of unique_ptr, you can’t copy it as you could do with a raw pointer. Use .get() or std::move depending on you use case

Thanks a lot for your response, I had already tried .get() which didn’t work, but std::move has worked. Thanks again, this forum is amazing!