Files
TransPyC/includes/ctraits.vpi

19 lines
683 B
Plaintext

"""ctraits — Compile-time type trait library
Provides compile-time type predicates with no runtime code generated.
All functions are evaluated exclusively at compile time and can be combined with conditional compilation constructs such as c.CIf.
"""
import t
def isptr(x: t.CType) -> bool:
"""Compile-time predicate to determine whether the type of x is a pointer.
Returns True if x is a pointer type (ptr_count > 0); otherwise returns False.
Can be used alongside c.CIf to implement conditional compilation.
Example:
if c.CIf(ctraits.isptr(my_var)):
# This branch compiles only when my_var is a pointer type
...
"""
pass