cmakepp_lang/types/implicitly_convertible
- cmakepp_lang/types/implicitly_convertible.cpp_implicitly_convertible(result from to)
Determines if an object of a given type can be passed as a different type.
CMakePP is a strongly-typed language with minimal implicit conversions. This function knows of all allowed implicit conversions and should be used to determine if it is okay to use one type in place of another.
Note
This function is used to implement
cpp_assert_signatureand thus can not rely oncpp_assert_signaturefor type-checking.Note
Pointer types are treated as being convertible to and from
desc. Pointer types are invariant currently, meaning one pointer type cannot be used in place of another, even if the base types would be convertible.- Parameters:
result (desc) – Name to use for the variable which will hold the result.
from (type) – The type we are attempting to cast from.
to (type) – The type we are attempting to cast to.
- Returns:
resultwill be set toTRUEif an instance offromcan be implicitly converted to an instance oftoandFALSEotherwise.- Return type:
bool
Error Checking
cpp_implicitly_convertiblewill assert that it is called with only three arguments, if this is not the case an error will be raised.