llvm::ValueFromPointerCast

Cast trait for constructing a value-typed To from a From pointer.

Synopsis

Declared in <llvm/Support/Casting.h>

template<
    typename To,
    typename From,
    typename Derived = void>
struct ValueFromPointerCast
    : CastIsPossible<To, From*>
    , NullableValueCastFailed<To>
    , DefaultDoCastIfPossible<To, From*, /* implementation-defined */>

Description

This cast trait provides casting for the specific case of casting to a value-typed object from a pointer-typed object. Note that To must be nullable/constructible from a pointer to From to use this cast.

Base Classes

NameDescription
CastIsPossible<To, From*>Trait that reports whether a cast from From to To is possible.
NullableValueCastFailed<To>Provides a declarative castFailed that constructs a null To.
DefaultDoCastIfPossible<To, From*, /* implementation-defined */>Provides a default doCastIfPossible that uses isPossible and doCast.

Static Member Functions

NameDescription
castFailed Returns a null To used when a cast fails.
doCast Constructs a To from pointer f.
doCastIfPossible Casts f to To if possible; otherwise returns castFailed().
isPossible Returns true if a cast from f to To is possible.