1

Topic: Help to change another's code

Again .  on SO such code sorting integrals in , also I try to alter it for std:: pair (value-> position) that it was sorted on first, but something somehow all is uneasy %) help,  at whom the desire is. I.e. it is supposed to use so: SortMyElements <5> se ({1,0}, {4,1}, {2,2}, {5,3}, {3,4});//test assert (se.data [0].first == 1 && se.data [0].second == 0); assert (se.data [1].first == 2 && se.data [1].second == 2); assert (se.data [2].first == 3 && se.data [2].second == 4); assert (se.data [3].first == 4 && se.data [3].second == 1); assert (se.data [4].first == 5 && se.data [4].second == 3); thanks)

2

Re: Help to change another's code

3

Re: Help to change another's code

Hello, Chorkov, you wrote: about, thanks! Whether a C> Only it is necessary to send such code in  even if you did not understand? Well, not that that I could not understand (as though, on my posts, like apparently that could) - simply I was today for ***  %)

4

Re: Help to change another's code

Hello, niXman, you wrote: X> the code sorting integrals in  X> for std:: pair (value-> position) that it was sorted on first In  all is: using namespace boost; template <int V, int P> using Value = mpl:: pair <mpl:: int _ <V>, mpl:: int _ <P>>; typedef mpl:: vector <Value <3, 12>, Value <5, 1>, Value <0, 16>>:: type RawData; typedef mpl:: sort <RawData, mpl:: less <mpl:: first <mpl:: _1>, mpl:: first <mpl:: _2>>>:: type SortedData; a working example: https://ideone.com/SptsSo