def __test_trivial( self, source, target ): if not ( source and target ): return False if is_same( source, target ): return True #X => X if is_const( target ) and is_same( source, target.base ): return True #X => const X if is_reference( target ) and is_same( source, target.base ): return True #X => X& if is_reference( target ) and is_const( target.base ) and is_same( source, target.base.base ): return True #X => const X& if is_same( target, cpptypes.pointer_t( cpptypes.void_t() ) ): if is_integral( source ) or is_enum( source ): return False else: return True #X => void* if is_pointer( source ) and is_pointer( target ): if is_const( target.base ) and is_same( source.base, target.base.base ): return True#X* => const X* if is_reference( source ) and is_reference( target ): if is_const( target.base ) and is_same( source.base, target.base.base ): return True#X& => const X& if not is_const( source ) and is_array( source ) and is_pointer( target ): if is_same( base_type(source), target.base ): return True#X[2] => X* if is_array( source ) and is_pointer( target ) and is_const( target.base ): if is_same( base_type(source), target.base.base ): return True
def is_void_pointer( type ): """returns True, if type represents `void*`, False otherwise""" return is_same( type, cpptypes.pointer_t( cpptypes.void_t() ) )
def is_void( type ): """returns True, if type represents `void`, False otherwise""" return remove_alias( type ) in create_cv_types( cpptypes.void_t() )