WPILibC++ 2024.1.1-beta-4
wpi::UniquePtrCast< To, From, Derived > Struct Template Reference

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

#include </home/runner/work/allwpilib/allwpilib/wpiutil/src/main/native/thirdparty/llvm/include/wpi/Casting.h>

Inheritance diagram for wpi::UniquePtrCast< To, From, Derived >:
wpi::CastIsPossible< To, From * > wpi::CastInfo< To, std::unique_ptr< From > >

Public Types

using Self = detail::SelfType< Derived, UniquePtrCast< To, From > >
 
using CastResultType = std::unique_ptr< std::remove_reference_t< typename cast_retty< To, From >::ret_type > >
 

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 wpi::CastIsPossible< To, From * >
static bool isPossible (const From * &f)
 

Detailed Description

template<typename To, typename From, typename Derived = void>
struct wpi::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.

Member Typedef Documentation

◆ CastResultType

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

◆ Self

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

Member Function Documentation

◆ castFailed()

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

◆ doCast()

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

◆ doCastIfPossible()

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

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