STD::REFERENCE_WRAPPER(3cxx)

πŸ‘‘ NAME

std::reference_wrapper< _Tp > β€” the primary class template for reference_wrapper, bestie. That's the whole vibe, no notes πŸ’…


✨ SYNOPSIS

#include <functional>

🌸 Public Types

  • typedef _Tp type β€” the type it's wrapping, lowkey the whole point of the class 🫢

πŸŽ€ Public Member Functions

  • the templated converting constructor β€” it's constexpr, and it's got a whole noexcept situation going on:
template<typename _Up , typename  = __not_same<_Up>, typename  =
    decltype(reference_wrapper::_S_fun(std::declval<_Up>()))> constexpr
    reference_wrapper (_Up &&__uref)
    noexcept(noexcept(reference_wrapper::_S_fun(std::declval< _Up >())))
  • reference_wrapper (const reference_wrapper &)=default β€” the copy constructor, defaulted, does exactly what it says on the tin ✨
  • constexpr _Tp & get () const noexcept β€” grabs you the reference back, constexpr and noexcept, iconic behaviour πŸ™ˆ
  • constexpr operator _Tp & () const noexcept β€” implicit conversion operator to _Tp &, same energy, constexpr, noexcept πŸ’–
  • the call operator operator() β€” forwards to whatever _Tp & is, with all the _Args...:
template<typename... _Args> constexpr __invoke_result< _Tp &, _Args...
    >::type operator() (_Args &&... __args) const
    noexcept(__is_nothrow_invocable< _Tp &, _Args... >::value)
  • reference_wrapper & operator= (const reference_wrapper &)=default β€” copy assignment, defaulted, moving right along πŸ¦‹
bestie read this part carefully: these are not member symbols. They live outside the class, they're just hanging out with it. Important distinction, no cap.
  • template<typename _Tp > constexpr reference_wrapper< _Tp > ref (_Tp &__t) noexcept β€” denotes a reference should be taken to a variable 🌈
  • template<typename _Tp > constexpr reference_wrapper< const _Tp > cref (const _Tp &__t) noexcept β€” denotes a const reference should be taken to a variable πŸŽ€
  • template<typename _Tp > constexpr reference_wrapper< _Tp > ref (reference_wrapper< _Tp > __t) noexcept β€” the std::ref overload to prevent wrapping a reference_wrapper 😭 (yes, so you can't wrap a wrapper, it's giving recursion protection)
  • template<typename _Tp > constexpr reference_wrapper< const _Tp > cref (reference_wrapper< _Tp > __t) noexcept β€” the std::cref overload to prevent wrapping a reference_wrapper πŸ’€

🌼 Detailed Description

template<typename _Tp>
class std::reference_wrapper< _Tp >

Primary class template for reference_wrapper. Short, sweet, load-bearing. Periodt. πŸ‘‘


  • template<typename _Tp > constexpr reference_wrapper< const _Tp > cref (const _Tp & __t) [related] β€” denotes a const reference should be taken to a variable 🌸
  • template<typename _Tp > constexpr reference_wrapper< const _Tp > cref (reference_wrapper< _Tp > __t) [related] β€” std::cref overload to prevent wrapping a reference_wrapper 🧚
  • template<typename _Tp > constexpr reference_wrapper< _Tp > ref (_Tp & __t) [related] β€” denotes a reference should be taken to a variable πŸ”₯
  • template<typename _Tp > constexpr reference_wrapper< _Tp > ref (reference_wrapper< _Tp > __t) [related] β€” std::ref overload to prevent wrapping a reference_wrapper ⭐

πŸ“ Author

Generated automatically by Doxygen for libstdc++ from the source code. Not me, not you, a robot did this. Slay, robot 🫢


okay that's the whole page bestie, mwah πŸ’‹ β€” this was libstdc++'s std::reference_wrapper< _Tp >(3cxx) and the version line is right there in the footer, so go be a main character with it πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from