20 lines
685 B
Plaintext
20 lines
685 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 the conditional
|
|
compilation statements cif / celif / celse.
|
|
"""
|
|
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 cif to implement conditional compilation.
|
|
|
|
Example:
|
|
cif ctraits.isptr(my_var):
|
|
# This branch compiles only when my_var is a pointer type
|
|
...
|
|
"""
|
|
pass |