#include <vector>
#include <list>
#include <functional>
#include <algorithm>
#include <iostream>
int main()
{
const std::list<int> lst { 5, 4, 9, 3, 1, 8, 0 } ;
for( const int& i : lst ) std::cout << i << " (" << &i << ") " ;
std::cout << '\n' ;
std::vector< std::reference_wrapper< const int > > vec( lst.begin(), lst.end() ) ;
std::sort( vec.begin(), vec.end() ) ;
for( const int& i : vec ) std::cout << i << " (" << &i << ") " ;
std::cout << '\n' ;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDxmdW5jdGlvbmFsPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8aW9zdHJlYW0+CgppbnQgbWFpbigpCnsKICAgIGNvbnN0IHN0ZDo6bGlzdDxpbnQ+IGxzdCB7IDUsIDQsIDksIDMsIDEsIDgsIDAgfSA7CiAgICBmb3IoIGNvbnN0IGludCYgaSA6IGxzdCApIHN0ZDo6Y291dCA8PCBpIDw8ICIgKCIgPDwgJmkgPDwgIikgIiAgOwogICAgc3RkOjpjb3V0IDw8ICdcbicgOwoKICAgIHN0ZDo6dmVjdG9yPCBzdGQ6OnJlZmVyZW5jZV93cmFwcGVyPCBjb25zdCBpbnQgPiA+IHZlYyggbHN0LmJlZ2luKCksIGxzdC5lbmQoKSApIDsKICAgIHN0ZDo6c29ydCggdmVjLmJlZ2luKCksIHZlYy5lbmQoKSApIDsKICAgIGZvciggY29uc3QgaW50JiBpIDogdmVjICkgc3RkOjpjb3V0IDw8IGkgPDwgIiAoIiA8PCAmaSA8PCAiKSAiICA7CiAgICBzdGQ6OmNvdXQgPDwgJ1xuJyA7Cn0K