Por qué siguiente programa no devuelve como valor mínimo 1.std :: vector y std :: comportamiento min
#include <vector>
#include <algorithm>
#include <iostream>
int main (int argc, char **argv) {
std::vector<int> test;
test.push_back(INT_MAX);
test.push_back(1);
int min = *(std::min(test.begin(), test.end()));
std::cout << "Minimum = " << min << std::endl;
}
Devuelve minimum
valores como 2147483647
Ah, esto es casi seguro lo que él quiere. – GManNickG
El valor de retorno de 'std :: min_element()' es un iterador por lo que debe eliminarse la referencia. – hmjd
@hmjd Sí, tienes razón. – FailedDev