================
@@ -71,20 +71,43 @@ inline bool fromJSON(const llvm::json::Value &E, Embedding 
&Out,
 // Embedding
 
//===----------------------------------------------------------------------===//
 
+Embedding Embedding::operator+(const Embedding &RHS) const {
+  assert(this->size() == RHS.size() && "Vectors must have the same dimension");
+  Embedding Result(*this);
+  std::transform(this->begin(), this->end(), RHS.begin(), Result.begin(),
+                 std::plus<double>());
+  return Result;
+}
+
 Embedding &Embedding::operator+=(const Embedding &RHS) {
   assert(this->size() == RHS.size() && "Vectors must have the same dimension");
----------------
svkeerthy wrote:

Implemented <operator> in terms of <operator>= as it would avoid copies in 
<operator>=.

https://github.com/llvm/llvm-project/pull/145118
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to