adding directives to choose partial_sort instead of nth_element when gcc version =< 4.8.2 is used