title: boost-units - using a dimensionless type of arbitrary system
body: <p>I am trying to make a dimensioned vector class with boost-units like so,</p>
  
  <pre><code>//vector will be constructed vec&lt;si::length&gt; v(10, 1.0*si::metre);
  template&lt;typename dimension&gt;
  class vec
  {
    public:
    //constructor setting all values to q.
    vec(const size_t, const boost::units::quantity&lt;dimension&gt; q)
    //etc
  }
  </code></pre>
  
  <p>It all works fine except for the <code>operator*=</code> and <code>operator/=</code> that do element wise multiplication and division. Since these do not change the dimension, they only make sense when multiplying/dividing by a dimensionless quantity: I am struggling to find an arbitrary dimensionless quantity that is not locked into a specific system (e.g. si or cgs units). </p>
  
  <p>I want something like,</p>
  
  <pre><code>  /** Multiply a dimensionless vector. */
    vec&lt;dimension&gt;&amp; 
    operator*=(const vec&lt;boost::units::dimensionless_type&gt;&amp; b);
  </code></pre>
  
  <p>or perhaps some metaprogramming magic (I notice boost::units::is_dimensionless exists, but I have no idea how to use it as I am not versed in general metaprogramming techniques)</p>
  
  <pre><code>  template&lt;typename dimension&gt;
    template&lt;typename a_dimensionless_type&gt;
    vec&lt;dimension&gt;&amp; 
    vec&lt;dimension&gt;::operator*=(const vec&lt;a_dimensionless_type&gt;&amp; b){
      //some compile time check to make sure that a_dimensionless_type is actually dimensionless?
      //the rest of the function
    }
  </code></pre>
  
  <p>I want following examples to compile</p>
  
  <pre><code>  vec&lt;si::dimensionless&gt; d(10, 2.0);
    vec&lt;si::length&gt;  l(10, 2.0*si::metre);
    l*=d;
  
    vec&lt;cgs::dimensionless&gt; d2(10, 2.0);
    vec&lt;cgs::length&gt;  l2(10, 2.0*cgs::centimetre);
    l2*=d2;
  </code></pre>