I would like to create a vector of pair starting from a pair of vector. For example, if A is a std::vector A = [1 0 1] and B= [0 1 0], I want a structure C = [1 0, 0 1, 1 0] where C_i = std::pair(A_i,B_i).
I would avoid for loop through the two vector, so I'm looking for few lines code like std::transform.
I tried the following code:
std::vector<bool> boolPredLabel(tsLabels.size());
std::vector<bool> boolRealLabel(tsLabels.size());
std::vector<std::pair<bool,bool>> TrPrPair(tsLabels.size());
std::transform(boolRealLabel.begin(), boolRealLabel.end(), boolPredLabel.begin(), TrPrPair.begin(),std::make_pair());
This lead me to a compiler error:
error: no matching function for call to ‘make_pair()’
std::transform(boolRealLabel.begin(), boolRealLabel.end(), boolPredLabel.begin(), TrPrPair.begin(),std::make_pair());
...
note: candidate expects 2 arguments, 0 provided
std::transform(boolRealLabel.begin(), boolRealLabel.end(), boolPredLabel.begin(), TrPrPair.begin(),std::make_pair());
The message is clear, but I don't know what pass to the binary operator. I have to admit that I don't have a clear understanding of std::transform and I've just use it with functor so any explanations are welcome.
Aucun commentaire:
Enregistrer un commentaire