So I have a class defined as follows:
template<typename T>
class A
{
T data;
};
Now I want to create a vector of shared pointers to A dynamically without push_back so that I can do it in parallel.
What I am doing for so is the following:
int k = 8;
std::vector<std::shared_ptr<A<int>>> myvec(k);
for(int i=0; i<k; ++i)
{
myvec[i] = std::make_shared<A<int>>(new A<int>); // error here
}
Well, but I get the following error:
error C2664: 'A<T>::A(const A<T> &)' : cannot convert parameter 1
from 'A<T> ' to 'const A<T> &'
How to fix this? Thanks in advance.