Bump S-nail v14.9.16.ar ("Message of Winter, your hopes shall be crushed"), 2019...
[s-mailx.git] / include / su / sort.h
blob01ee15b8fa5a1a7fd79c2026747fe2fe6251d9ca
1 /*@ Sorting (of arrays).
3 * Copyright (c) 2001 - 2019 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
4 * SPDX-License-Identifier: ISC
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #ifndef su_SORT_H
19 #define su_SORT_H
20 #include <su/code.h>
21 #define su_HEADER
22 #include <su/code-in.h>
23 C_DECL_BEGIN
24 EXPORT void su_sort_shell_vpp(void const **arr, uz entries,
25 su_compare_fun cmp_or_nil);
26 C_DECL_END
27 #include <su/code-ou.h>
28 #if !su_C_LANG || defined CXX_DOXYGEN
29 # define su_CXX_HEADER
30 # include <su/code-in.h>
31 NSPC_BEGIN(su)
32 class sort;
33 class sort{
34 public:
35 template<class T>
36 static void shell(T const **arr, uz entries,
37 typename type_toolbox<T>::compare_fun cmp_or_nil){
38 ASSERT_RET_VOID(entries == 0 || arr != NIL);
39 su_sort_shell_vpp(R(void const**,arr), entries,
40 R(su_compare_fun,cmp_or_nil));
43 NSPC_END(su)
44 # include <su/code-ou.h>
45 #endif /* !C_LANG || CXX_DOXYGEN */
46 #endif /* su_PRIME_H */
47 /* s-it-mode */