folly::fmap_shared_ptr_aliasing

fmap_shared_ptr_aliasing overloads

Synopses

Declared in <folly/Memory.h>

Deleted overload of fmap_shared_ptr_aliasing rejecting a null owner.

template<typename GetU>
auto
fmap_shared_ptr_aliasing(
    std::nullptr_t owner,
    GetU&& getU) = delete;
» more...

fmap_shared_ptr_aliasing

template<
    typename T,
    typename GetU,
    typename U = std::remove_pointer_t<std::invoke_result_t<GetU&, T const*>>>
std::shared_ptr<U>
fmap_shared_ptr_aliasing(
    std::shared_ptr<T> const& owner,
    GetU getU);
» more...

Overload of fmap_shared_ptr_aliasing that moves from owner.

template<
    typename T,
    typename GetU,
    typename U = std::remove_pointer_t<std::invoke_result_t<GetU&, T const*>>>
std::shared_ptr<U>
fmap_shared_ptr_aliasing(
    std::shared_ptr<T>&& owner,
    GetU getU);
» more...

Return Value

  • a shared_ptr to the field U or nullptr if the owner is nullptr or getU returns nullptr.
  • A shared_ptr to the field U, or nullptr if owner or getU yields nullptr.

Parameters

NameDescription
ownerthe shared_ptr that owns the object of type T
getUa function that returns a const pointer to the field of type U by taking a const T* as an argument.