Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

What is the right way to static_cast a vector in C++

I have my c++ code which I need to static cast a vector object A to vector object B. This is my c++ code:

void notifyTestResultEvent(ObjectA &results) {
    std::cout << results << std::endl;
    std::vector<ObjectA> res;
    res = results.getResults();
    std::copy(res.begin(), res.end(), ra.begin());

}

ra is the vector of objectB.

According to an answer from Stackoverflow. I tried to use std::copy() but it shows error error: no match for 'operator=' (operand types are ...

I am not really sure what is the right way to cast a vector in C++.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...