mojo icon indicating copy to clipboard operation
mojo copied to clipboard

[Feature Request] `is_trivial`

Open rd4com opened this issue 4 months ago • 0 comments

Review Mojo's priorities

What is your request?

It would be nice to have a function that check if an AnyRegType became AnyType:

fn is_trivial[T:AnyTrivialRegType]()->Bool:
    return True
fn is_trivial[T:AnyType]()->Bool:
    return False

def main():
    print(is_trivial[Int]()) #not yet

What is your motivation for this change?

To simplify List that currently take 2 parameters: type and is_trivial_hint,

it could also be useful in InlinedFixedVector.__del__ :+1:

Any other details?

No response

rd4com avatar Oct 01 '24 04:10 rd4com