# sorting with a custom comparison function

**URL:** <https://forums.developer.nvidia.com/t/sorting-with-a-custom-comparison-function/12653>\
**Category:** CUDA Programming and Performance\
**Created:** [October 7, 2009, 6:46pm UTC](https://forums.developer.nvidia.com/t/sorting-with-a-custom-comparison-function/12653 "2009-10-07T18:46:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@hans](https://forums.developer.nvidia.com/u/hans)\
**Post date:** [October 7, 2009, 6:46pm UTC](https://forums.developer.nvidia.com/t/sorting-with-a-custom-comparison-function/12653/1 "2009-10-07T18:46:46Z")

</div>

Hello,

Are there any sorting libraries which permit the user to define a custom comparison function in a similar way that one would do with qsort in C?

---

<div class="post-metadata">

**Author:** ![eelsen](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@eelsen](https://forums.developer.nvidia.com/u/eelsen)\
**Post date:** [October 7, 2009, 8:14pm UTC](https://forums.developer.nvidia.com/t/sorting-with-a-custom-comparison-function/12653/2 "2009-10-07T20:14:04Z")

</div>

> [@](#):
>
> Hello,
> 
> Are there any sorting libraries which permit the user to define a custom comparison function in a similar way that one would do with qsort in C?

Yes, take a look a Thrust.
