How to make a const SharedPtr?

I’ve got this code, which used to work fine with v20.10 of C++ lib.

SharedPtr<System::Drawing::Bitmap> bmp = _slide->GetThumbnail(scaleX, scaleY);
SharedPtr<MemoryStream> stream = MakeObject<MemoryStream>();

bmp->Save(stream, format == "png" ? png : jpeg);

This doesn’t work with the latest version, however, because Save() now expects its arguments to be const.

How can I make

SharedPtr

const? I mean, const SharedPtr doesn’t work.

I’m getting compiler errors about “no matching function for call to Save(…)”. Because the first argument is not const.

Thanks advance!

@gtamas,
Thank you for your request. You should include the necessary header as below:

#include <system/io/memory_stream.h>

Thanks Andrey, works now.