LLVM: llvm::ConstStrippingForwardingCast< To, From, ForwardTo (original) (raw)

Provides a cast trait that strips const from types to make it easier to implement a const-version of a non-const cast. More...

#include "[llvm/Support/Casting.h](Casting%5F8h%5Fsource.html)"

Public Types
using DecayedFrom = std::remove_cv_t<std::remove_pointer_t>
using NonConstFrom
Static Public Member Functions
static bool isPossible (const From &f)
static decltype(auto) castFailed ()
static decltype(auto) doCast (const From &f)
static decltype(auto) doCastIfPossible (const From &f)

template<typename To, typename From, typename ForwardTo>
struct llvm::ConstStrippingForwardingCast< To, From, ForwardTo >

Provides a cast trait that strips const from types to make it easier to implement a const-version of a non-const cast.

It just removes boilerplate and reduces the amount of code you as the user need to implement. You can use it like this:

template<> struct CastInfo<foo, bar> { ...verbose implementation... };

template<> struct CastInfo<foo, const bar> : public ConstStrippingForwardingCast<foo, const bar, CastInfo<foo, bar>> {};

Definition at line 388 of file Casting.h.

DecayedFrom

template<typename To, typename From, typename ForwardTo>

NonConstFrom

template<typename To, typename From, typename ForwardTo>

Initial value:

std::conditional_t<std::is_pointer_v, DecayedFrom *, DecayedFrom &>

std::remove_cv_t< std::remove_pointer_t< From > > DecayedFrom

Definition at line 392 of file Casting.h.

castFailed()

template<typename To, typename From, typename ForwardTo>

doCast()

template<typename To, typename From, typename ForwardTo>

doCastIfPossible()

template<typename To, typename From, typename ForwardTo>

isPossible()

template<typename To, typename From, typename ForwardTo>


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