diff jmedcouple.c++ @ 35:6c264f2053bc

jmedcouple: use std::tie and std::move for tuple unpacking
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 19 Jan 2015 10:20:22 -0500
parents 2e277129e81b
children 4fb3b87b8610
line wrap: on
line diff
--- a/jmedcouple.c++
+++ b/jmedcouple.c++
@@ -46,11 +46,14 @@
     long wleft = 0, wright = 0;
 
     for (aw_t& aw: AW ) {
-      if (aw.first > trial)
-        wleft += aw.second;
+      double a;
+      long w;
+      tie(a, w) = move(aw);
+      if (a > trial)
+        wleft += w;
       else
         // This also includes a == trial, i.e. the "middle" weight.
-        wright += aw.second;
+        wright += w;
     }
 
     if (2*wleft > wtot)