Diziyi aynı dizinin sonuna ters sırayla kopyalamak ve aynı zamanda değerlerin cebirsel işaretini değiştirmek istiyorum. Tersine diziyi kopyalayın
void foo()
{
std::vector<int> vec;
for(int = 0; i < 5; i++)
{
vec.push_back(i);
}
//Now i want the values in vec to be copied to the end in reverse order.
//I would like to have something like that :
std::copy(std::end(vec), std::begin(vec), std::back_inserter(vec))
//so now vec should look like: 0 1 2 3 4 4 3 2 1 0
//But I want: 0 1 2 3 4 -4 -3 -2 -1 -0
}
zaten (partition_copy falan gibi) İstediğimi yapmak çimdik ya da ben belki kendi işimi kullanmak zorunda olduğunu, var olan bir std standart işlevi var mı:
Böyle bir şey uygun bir lambda fonksiyonu ile std :: for_each gibi?
Bu, "std :: transform"] için bir işe benziyor (http://en.cppreference.com/w/cpp/algorithm/transform). –