13
13
#include <functional> // for std::less and std::less_equal
14
14
15
15
// Enumerators for the variant of binsearch
16
- enum arg_t
16
+ enum class arg_t
17
17
{
18
18
noarg ,
19
19
arg
20
20
};
21
- enum side_t
21
+ enum class side_t
22
22
{
23
23
left ,
24
24
right
@@ -29,25 +29,25 @@ template <class Tag, side_t side>
29
29
struct side_to_cmp ;
30
30
31
31
template < class Tag >
32
- struct side_to_cmp < Tag , left > {
32
+ struct side_to_cmp < Tag , side_t :: left > {
33
33
static constexpr auto value = Tag ::less ;
34
34
};
35
35
36
36
template < class Tag >
37
- struct side_to_cmp < Tag , right > {
37
+ struct side_to_cmp < Tag , side_t :: right > {
38
38
static constexpr auto value = Tag ::less_equal ;
39
39
};
40
40
41
41
template < side_t side >
42
42
struct side_to_generic_cmp ;
43
43
44
44
template < >
45
- struct side_to_generic_cmp < left > {
45
+ struct side_to_generic_cmp < side_t :: left > {
46
46
using type = std ::less < int > ;
47
47
};
48
48
49
49
template < >
50
- struct side_to_generic_cmp < right > {
50
+ struct side_to_generic_cmp < side_t :: right > {
51
51
using type = std ::less_equal < int > ;
52
52
};
53
53
@@ -273,7 +273,7 @@ template <arg_t arg>
273
273
struct binsearch_base ;
274
274
275
275
template < >
276
- struct binsearch_base < arg > {
276
+ struct binsearch_base < arg_t :: arg > {
277
277
using function_type = PyArray_ArgBinSearchFunc * ;
278
278
struct value_type {
279
279
int typenum ;
@@ -285,18 +285,18 @@ struct binsearch_base<arg> {
285
285
{
286
286
return std ::array < value_type , sizeof ...(Tags )> {
287
287
value_type {Tags ::type_value ,
288
- {(function_type )& argbinsearch < Tags , left > ,
289
- (function_type )argbinsearch < Tags , right > }}...};
288
+ {(function_type )& argbinsearch < Tags , side_t :: left > ,
289
+ (function_type )argbinsearch < Tags , side_t :: right > }}...};
290
290
}
291
291
static constexpr std ::array < function_type , 2 > npy_map = {
292
- (function_type )& npy_argbinsearch < left > ,
293
- (function_type )& npy_argbinsearch < right > };
292
+ (function_type )& npy_argbinsearch < side_t :: left > ,
293
+ (function_type )& npy_argbinsearch < side_t :: right > };
294
294
};
295
- constexpr std ::array < binsearch_base < arg > ::function_type , 2 >
296
- binsearch_base < arg > ::npy_map ;
295
+ constexpr std ::array < binsearch_base < arg_t :: arg > ::function_type , 2 >
296
+ binsearch_base < arg_t :: arg > ::npy_map ;
297
297
298
298
template < >
299
- struct binsearch_base < noarg > {
299
+ struct binsearch_base < arg_t :: noarg > {
300
300
using function_type = PyArray_BinSearchFunc * ;
301
301
struct value_type {
302
302
int typenum ;
@@ -308,15 +308,15 @@ struct binsearch_base<noarg> {
308
308
{
309
309
return std ::array < value_type , sizeof ...(Tags )> {
310
310
value_type {Tags ::type_value ,
311
- {(function_type )& binsearch < Tags , left > ,
312
- (function_type )binsearch < Tags , right > }}...};
311
+ {(function_type )& binsearch < Tags , side_t :: left > ,
312
+ (function_type )binsearch < Tags , side_t :: right > }}...};
313
313
}
314
314
static constexpr std ::array < function_type , 2 > npy_map = {
315
- (function_type )& npy_binsearch < left > ,
316
- (function_type )& npy_binsearch < right > };
315
+ (function_type )& npy_binsearch < side_t :: left > ,
316
+ (function_type )& npy_binsearch < side_t :: right > };
317
317
};
318
- constexpr std ::array < binsearch_base < noarg > ::function_type , 2 >
319
- binsearch_base < noarg > ::npy_map ;
318
+ constexpr std ::array < binsearch_base < arg_t :: noarg > ::function_type , 2 >
319
+ binsearch_base < arg_t :: noarg > ::npy_map ;
320
320
321
321
// Handle generation of all binsearch variants
322
322
template < arg_t arg >
@@ -392,12 +392,12 @@ extern "C" {
392
392
NPY_NO_EXPORT PyArray_BinSearchFunc *
393
393
get_binsearch_func (PyArray_Descr * dtype , NPY_SEARCHSIDE side )
394
394
{
395
- return _get_binsearch_func < noarg > (dtype , side );
395
+ return _get_binsearch_func < arg_t :: noarg > (dtype , side );
396
396
}
397
397
398
398
NPY_NO_EXPORT PyArray_ArgBinSearchFunc *
399
399
get_argbinsearch_func (PyArray_Descr * dtype , NPY_SEARCHSIDE side )
400
400
{
401
- return _get_binsearch_func < arg > (dtype , side );
401
+ return _get_binsearch_func < arg_t :: arg > (dtype , side );
402
402
}
403
403
}
0 commit comments