I have seen a similar discussion here (C++ Code Analysis in Visual Studio Community 2019 produces warnings C26486 and C26414) where it refers to using std::move
but I am not sure if this is what I need to do.
I turned CRecordset *pRecords = new CRecordSet(&m_dbDatabase)
into smart pointers. Like this:
auto pRecordset = std::make_unique<CRecordset>(&m_dbDatabase);
Now I get 8 similar code analysis warnings:
C26414: Move, copy, reassign or reset a local smart pointer 'pRecords' (r.5).
I think I understand that fact that this could be turned into a member variable of my CPTSDatabase
class, that is populated when the database is opened. And then simply use the same pointer.
In an attempt to try and do that I added this to my header file:
auto m_pRecords = std::unique_ptr<CRecordSet>;
Then I was going to do this after opening the database:
m_pRecords = std::make_unique<CRecordSet>(&m_dbDatabase);
But it does not like how I defined the variable.
How do I resolve this?