LLVM 22.0.0git
llvm::UniquePtrCast< To, From, Derived > Struct Template Reference

This cast trait provides std::unique_ptr casting. More...

#include "llvm/Support/Casting.h"

Inheritance diagram for llvm::UniquePtrCast< To, From, Derived >:
[legend]

Public Types

using Self = detail::SelfType<Derived, UniquePtrCast<To, From>>
using CastResultType

Static Public Member Functions

static CastResultType doCast (std::unique_ptr< From > &&f)
static CastResultType castFailed ()
static CastResultType doCastIfPossible (std::unique_ptr< From > &f)
Static Public Member Functions inherited from llvm::CastIsPossible< To, From * >
static bool isPossible (const From &f)

Detailed Description

template<typename To, typename From, typename Derived = void>
struct llvm::UniquePtrCast< To, From, Derived >

This cast trait provides std::unique_ptr casting.

It has the semantics of moving the contents of the input unique_ptr into the output unique_ptr during the cast. It's also a good example of how to implement a move-only cast.

Definition at line 343 of file Casting.h.

Member Typedef Documentation

◆ CastResultType

template<typename To, typename From, typename Derived = void>
using llvm::UniquePtrCast< To, From, Derived >::CastResultType
Initial value:
std::unique_ptr<
std::remove_reference_t<typename cast_retty<To, From>::ret_type>>

Definition at line 345 of file Casting.h.

◆ Self

template<typename To, typename From, typename Derived = void>
using llvm::UniquePtrCast< To, From, Derived >::Self = detail::SelfType<Derived, UniquePtrCast<To, From>>

Definition at line 344 of file Casting.h.

Member Function Documentation

◆ castFailed()

template<typename To, typename From, typename Derived = void>
CastResultType llvm::UniquePtrCast< To, From, Derived >::castFailed ( )
inlinestatic

Definition at line 352 of file Casting.h.

Referenced by llvm::cast_if_present(), and doCastIfPossible().

◆ doCast()

template<typename To, typename From, typename Derived = void>
CastResultType llvm::UniquePtrCast< To, From, Derived >::doCast ( std::unique_ptr< From > && f)
inlinestatic

Definition at line 348 of file Casting.h.

Referenced by llvm::cast_if_present(), and doCastIfPossible().

◆ doCastIfPossible()

template<typename To, typename From, typename Derived = void>
CastResultType llvm::UniquePtrCast< To, From, Derived >::doCastIfPossible ( std::unique_ptr< From > & f)
inlinestatic

Definition at line 354 of file Casting.h.

References castFailed(), and doCast().


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