将 .py 和 .pyi 后缀名改为了 .vp 和 .vpi 后缀名
This commit is contained in:
19
includes/ctraits.vpi
Normal file
19
includes/ctraits.vpi
Normal file
@@ -0,0 +1,19 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user