title: Column operations and conditions in C++
body: <p>I am writing a framework which works with columns as main objects:</p>
  
  <pre><code>template &lt;typename T&gt;
  class Column : private std::vector&lt;T&gt;
  {
  public:
    typedef typename std::vector&lt;T&gt; Container;
    // using vector's methods
    using Container::...
  };
  </code></pre>
  
  <p>I have add arithmetic operations:</p>
  
  <pre><code>template &lt;typename T1, typename T2&gt;
  auto operator+(const Column&lt;T1&gt;&amp; c1, const Column&lt;T2&gt;&amp; c2) -&gt; Column&lt;decltype(c1[0] + c2[0])&gt;;
  
  template &lt;typename T1, typename T2&gt;
  auto operator+(const Column&lt;T1&gt;&amp; c1, T2 scalar) -&gt; Column&lt;decltype(c1[0] + scalar)&gt;;
  
  template &lt;typename T1, typename T2&gt;
  auto operator+(T1 scalar, const Column&lt;T2&gt;&amp; c2) -&gt; Column&lt;decltype(scalar + c2[0])&gt;;
  // and others like -, /, abs, sin, &lt;, &lt;=, &gt;, &amp;&amp;, ...
  </code></pre>
  
  <p>No I can use Column in all kind of mathematical operations. Yet I also would like to do column conditional operations (then statement executes only for rows with condition true):</p>
  
  <pre><code>Column&lt;bool&gt; condition; // fill with {false, true, true, false}
  Column&lt;double&gt; a; // fill with {0, 1, 2, 3}
  Column&lt;double&gt; b;
  IF (condition)
  ([&amp;a, &amp;b]()
  {
    b = a + 1; // desired b column: {0, 2, 3, 3}
  })
  </code></pre>
  
  <p>Is it possible to do something like that (to hide indices inside some conditional functor IF)?</p>