LLVM 19.0.0git
Static Public Member Functions | List of all members
llvm::ForwardToPointerCast< To, From, ForwardTo > Struct Template Reference

Provides a cast trait that uses a defined pointer to pointer cast as a base for reference-to-reference casts. More...

#include "llvm/Support/Casting.h"

Static Public Member Functions

static bool isPossible (const From &f)
 
static decltype(auto) doCast (const From &f)
 

Detailed Description

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

Provides a cast trait that uses a defined pointer to pointer cast as a base for reference-to-reference casts.

Note that it does not provide castFailed and doCastIfPossible because a pointer-to-pointer cast would likely just return nullptr which could cause nullptr dereference. You can use it like this:

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

template <> struct CastInfo<foo, bar> : public ForwardToPointerCast<foo, bar, CastInfo<foo, bar *>> {};

Definition at line 423 of file Casting.h.

Member Function Documentation

◆ doCast()

template<typename To , typename From , typename ForwardTo >
static decltype(auto) llvm::ForwardToPointerCast< To, From, ForwardTo >::doCast ( const From f)
inlinestatic

Definition at line 428 of file Casting.h.

◆ isPossible()

template<typename To , typename From , typename ForwardTo >
static bool llvm::ForwardToPointerCast< To, From, ForwardTo >::isPossible ( const From f)
inlinestatic

Definition at line 424 of file Casting.h.


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