Hi, I’m trying to pass a type into a generic function and preserve the type exactly as it is.
Here is a simplified example:
def gen_func(t: type<auto(T1)>) {
print("type: {typeinfo fulltypename(type<T1>)}\n")
}
gen_func(type<int>) // prints: type: int const
// expected: type: int
gen_func(type<int const>) // prints: type: int const
// this matches my expectation
When I call gen_func(type<int>), T1 seems to become int const.
However, I would like it to remain int.
Is there a way to pass the type into the generic function exactly as provided, without automatically adding const?
Hi, I’m trying to pass a type into a generic function and preserve the type exactly as it is.
Here is a simplified example:
When I call
gen_func(type<int>),T1seems to becomeint const.However, I would like it to remain
int.Is there a way to pass the type into the generic function exactly as provided, without automatically adding
const?