labath added a comment.

The copy constructors and assignment operators are very repetitive. What would 
you say to a function like

  template<typename T>
  void clone(std::unique_ptr<T> &dest, const std::unique_ptr<T> &src) {
  if (&dest == &src)
    return;
  if (src)
    dest = llvm::make_unique<T>(*src);
  else
    dest.reset();
  }

(and a similar one for shared_ptrs)? Then both copy constructors and assignment 
operators could be just implemented as `clone(m_whatever, rhs.m_whatever);`. 
(Assuming we don't care about pessimizing the self-assignment case this could 
even be `m_whatever = clone(rhs.m_whatever);`)


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58946/new/

https://reviews.llvm.org/D58946



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to