Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/05/2013, 07:23
amchacon
 
Fecha de Ingreso: julio-2012
Mensajes: 375
Antigüedad: 11 años, 9 meses
Puntos: 28
Respuesta: Ordenar vector con struct?

Creo que se hace con listas:

Código:
#include <list>

//...

list<date> Lista;
    
    date x;
    x.a = 5;
    x.b = 9;
    
    date y;
    y.a = 5;
    y.b = 7;
    
    date z;
    z.a = 5;
    z.b = 99;
    
    Lista.push_back(x);
    Lista.push_back(y);
    Lista.push_back(z);
    
    Lista.sort(compare);

 for (list<date>::iterator it = Lista.begin(); it != Lista.end(); it++)
      cout<< it->a <<" "<< it->b << endl;