unique_dyn_cast overloads

Synopses

Declared in <llvm/Support/Casting.h>

Cast unique_ptr Val to X, taking ownership only when the cast succeeds.

template<
    class X,
    class Y>
[[nodiscard]]
CastInfo<X, std::unique_ptr<Y>>::CastResultType
unique_dyn_cast(std::unique_ptr<Y>& Val);

Rvalue overload that forwards to the lvalue unique_dyn_cast.

template<
    class X,
    class Y>
[[nodiscard]]
auto
unique_dyn_cast(std::unique_ptr<Y>&& Val);

Return Value

  • A unique_ptr of X on success, or null if the cast fails.

  • The result of the lvalue unique_dyn_cast.

Note

The return value should not be discarded.

Parameters

Name

Description

Val

unique_ptr to test; moved from only when the cast succeeds.

Created with MrDocs