Exemple #1
0
    void add_ptr_convs(TypeIndex index)
    {
        TypeInfo bare = index.get_info().class_type();
        //add_conv_track<void>(bare);
        //add_conv_track<void const>(bare.as_const_value());

        auto bottom_ptr_type = create_type_mirror("BottomPtr", size_t(0), create_bottom_ptr_type_index(), type_system->global_namespace().get_class_type());
        type_system->add_class(create_bottom_ptr_type_index(), bottom_ptr_type, type_system->global_namespace());

        // allow unsafe_ptr_cast to convert to any type and nil (NULL) to any pointer type
        add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_nonconst(), "bottom ptr unsafe cast to any ptr");
        add_nochange_conv(create_bottom_ptr_type_info(), bare.as_ptr_to_const(), "bottom ptr unsafe cast to any const ptr");

        // allow any ptr to be converted to void* or void const*
        add_nochange_conv(bare.as_ptr_to_nonconst(), TypId<void*>::restricted().get_info(), "any ptr to void ptr");
        add_nochange_conv(bare.as_ptr_to_const(), TypId<void const*>::restricted().get_info(), "any ptr to const void ptr");
    }
Exemple #2
0
LIKEMAGIC_API TypeIndex create_bottom_ptr_type_index()
{
    return get_index(create_bottom_ptr_type_info());
}