new_value Class — pytorch Architecture
Architecture documentation for the new_value class in List.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/core/List.h lines 67–108
template<class T, class Iterator>
class ListElementReference final {
public:
operator std::conditional_t<
std::is_reference_v<typename c10::detail::
ivalue_to_const_ref_overload_return<T>::type>,
const T&,
T>() const;
ListElementReference& operator=(T&& new_value) &&;
ListElementReference& operator=(const T& new_value) &&;
// assigning another ref to this assigns the underlying value
ListElementReference& operator=(ListElementReference&& rhs) && noexcept;
const IValue& get() const& {
return *iterator_;
}
friend void swap<T, Iterator>(ListElementReference&& lhs, ListElementReference&& rhs) noexcept;
ListElementReference(const ListElementReference&) = delete;
ListElementReference& operator=(const ListElementReference&) = delete;
~ListElementReference() = default;
private:
ListElementReference(Iterator iter)
: iterator_(iter) {}
// allow moving, but only our friends (i.e. the List class) can move us
ListElementReference(ListElementReference&&) noexcept = default;
ListElementReference& operator=(ListElementReference&& rhs) & noexcept {
iterator_ = std::move(rhs.iterator_);
return *this;
}
friend class List<T>;
friend class ListIterator<T, Iterator>;
Iterator iterator_;
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free