const/non-const template type deduction with fused types

27 views
Skip to first unread message

evgeny.b...@gmail.com

unread,
Dec 19, 2024, 8:44:01 AM12/19/24
to cython-users
Hi,

I looking at this fused types / c++ template dediction issue, 

Poking around, it looks like template deduction code treats const and non-const types (e.g.  `const int32_t *` and `int32_t *`) as totally unrelated. Dropping a breakpoint, I see things like

```
(Pdb) arg_types_for_deduction[1]
<CPtrType <CConstOrVolatileType const <CTypedefType int32_t>>>
(Pdb) arg_types_for_deduction[1].typeof_name()
'const int32_t *'
```

So I wonder if there's  a recommended way to effectively const-cast, to construct from `arg_types_for_deduction[1]` above its non-const analog? My thought was that if there's a way, the template resolver can try const and non-const versions (around https://github.com/cython/cython/blob/master/Cython/Compiler/PyrexTypes.py#L5049)

So I wonder if a general direction makes sense? Would appreciate any sorts of pointers, really!

Cheers,

Evgeni

Or maybe I'm looking


Reply all
Reply to author
Forward
0 new messages