LLVM 20.0.0git
|
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"
Public Types | |
using | DecayedFrom = std::remove_cv_t< std::remove_pointer_t< From > > |
using | NonConstFrom = std::conditional_t< std::is_pointer_v< From >, DecayedFrom *, DecayedFrom & > |
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) |
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>> {};
using llvm::ConstStrippingForwardingCast< To, From, ForwardTo >::DecayedFrom = std::remove_cv_t<std::remove_pointer_t<From> > |
using llvm::ConstStrippingForwardingCast< To, From, ForwardTo >::NonConstFrom = std::conditional_t<std::is_pointer_v<From>, DecayedFrom *, DecayedFrom &> |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |