#include <iostream>
#include <memory>
using namespace std;
class T1 {};
class T2
{
public:
T2(T1&& var) : m_var(std::move(var)) {}
private:
T1&& m_var;
};
int main()
{
std::shared_ptr<T1> ptr = std::make_shared<T1>();
auto pResultElement = std::make_shared<T2>(std::move(*ptr));
return 0;
}
// БЫЛО
ArrayOut struct_temp;
struct_temp.low = maxleft;
struct_temp.high = maxright;
struct_temp.sum = leftsum + rightsum;
return struct_temp;
// СТАЛО
return ArrayOut(maxleft, maxright, leftsum + rightsum);
ArrayOut left = Find_Maximum_Subarray(A, low, mid);
…
if (left.sum >= right.sum && left.sum >= cross.sum) { … }
(vector<int> A, int low…)
лучше (const vector<int> &A, int low…)