LibreOffice Module onlineupdate (master) 1
|
IsConvertible determines whether a value of type From will implicitly convert to a value of type To. More...
#include <TypeTraits.h>
Additional Inherited Members | |
Public Types inherited from mozilla::IntegralConstant< bool, detail::ConvertibleTester< From, To >::value > | |
typedef bool | ValueType |
typedef IntegralConstant< bool, Value > | Type |
Static Public Attributes inherited from mozilla::IntegralConstant< bool, detail::ConvertibleTester< From, To >::value > | |
static const bool | value |
IsConvertible determines whether a value of type From will implicitly convert to a value of type To.
For example:
struct A {}; struct B : public A {}; struct C {};
mozilla::IsConvertible<A, A>::value is true; mozilla::IsConvertible<A*, A*>::value is true; mozilla::IsConvertible<B, A>::value is true; mozilla::IsConvertible<B*, A*>::value is true; mozilla::IsConvertible<C, A>::value is false; mozilla::IsConvertible<A, C>::value is false; mozilla::IsConvertible<A*, C*>::value is false; mozilla::IsConvertible<C*, A*>::value is false.
For obscure reasons, you can't use IsConvertible when the types being tested are related through private inheritance, and you'll get a compile error if you try. Just don't do it!
Note - we need special handling for void, which ConvertibleTester doesn't handle. The void handling here doesn't handle const/volatile void correctly, which could be easily fixed if the need arises.
Definition at line 646 of file TypeTraits.h.