问题
Can anyone help me solve the problem?? Before when I had only one method for class, which was void show(vector &list, string &filter), get&display functions were in it, then i decided to split those functions into vector get() & void display() but when i return a new modified vector from vector get() the error appears:
C26444 Avoid unnamed objects with custom construction and destruction (es.84).
Here's a short code example for realization:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Test
{
//variables
};
class Base
{
public:
virtual vector<Test>get(vector<Test>& list, string& filter) = 0;
virtual void display() = 0;
};
class A : public Base
{
string a;
string b;
vector<Test> aList;
public:
vector<Test>get(vector<Test>& list, string& filter)
{
//modifying info and placing to vector<Test> aList
return aList;
}
void display()
{
//show aList
}
};
int main()
{
vector<Test> list;
//define list
string filter;
//define filter
Base* object = new A();
object->get(list, filter);
object->display();
return 0;
}
来源:https://stackoverflow.com/questions/59634866/c26444avoid-unnamed-objects-with-custom-construction-and-destruction-es-84