LibreOffice Module onlineupdate (master) 1
List of all members
mozilla::IsConvertible< From, To > Struct Template Reference

IsConvertible determines whether a value of type From will implicitly convert to a value of type To. More...

#include <TypeTraits.h>

Inheritance diagram for mozilla::IsConvertible< From, To >:
[legend]
Collaboration diagram for mozilla::IsConvertible< From, To >:
[legend]

Additional Inherited Members

- Public Types inherited from mozilla::IntegralConstant< bool, detail::ConvertibleTester< From, To >::value >
typedef bool ValueType
 
typedef IntegralConstant< bool, ValueType
 
- Static Public Attributes inherited from mozilla::IntegralConstant< bool, detail::ConvertibleTester< From, To >::value >
static const bool value
 

Detailed Description

template<typename From, typename To>
struct mozilla::IsConvertible< From, To >

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.


The documentation for this struct was generated from the following file: