[prosv5]What's wrong with my code?

Can’t we build motors like this?
Is the sequence of Motor constructor execution?
code:
readSDcard(&_chassisPram, “/usd/chassis.txt”, “chassis”);
for (auto it = _chassisPram.begin(); it != _chassisPram.end(); it += 2)
{
if (it->first.find(“motor”) != std::string::npos)
{
_motorList.push_back(pros::Motor(stringToNum<uint8_t>(it->second), stringToNum<uint8_t>((it + 1)->second)));
std::cout << _name << “port:” << stringToNum<uint8_t>(it->second) << “isRevase:” << stringToNum<uint8_t>((it + 1)->second) << std::endl;
}
}

terminal:
chassis port:1 isRevase:0
chassis port:2 isRevase:0
chassis port:3 isRevase:1
chassis port:4 isRevase:1

address for vector:
0x3aba020
0x3aba028
0x3aba030
0x3aba038

What exactly is the problem?

1 Like

This can be done in previous versions.
After the update, I correctly read the value on the SD card, STD:: COUT can see. But no device can succeed.
I’m not sure why. Because I modified the stringToNum function.
But the strange test “std:: cout “means that he read the correct value” explicit pros:: Motor”" class determines the parameters before the link occurs?

I’m still not entirely sure what you mean. Is there an error? Some other kind of feedback that tells you this method doesn’t work?

sorry my english is poor

i use “std::vector<std::pairstd::string,std::string>” to save sd card data;
use
template
T stringToNum(const std::string &str)
{
std::istringstream iss(str);
T num;
iss >> num;
return num;b
}
to change string to nums;
but "pros::Motor pros::ADI " can’t be constructed;
Other common parameters can be read normally.

Right, is there a compiler error or linter warning related to this? Something like “no matching constructor…”?


The reason for warning is that