title: Overload power with correctly in c++?
body: <p>In c++ I implemented an <code>integer</code> class and I overloaded <code>operator ^</code> to be the power  function.</p>
  
  <pre><code>integer integer::operator^ (const integer&amp; rhs){
         return integer(pow(this-&gt;.i, rhs.i));
  }
  </code></pre>
  
  <p>This is working correctly for two operands.   </p>
  
  <pre><code>integer i1, i2, i3 ;   
   i4 = i1 ^ i2 ^ i3;  
  </code></pre>
  
  <p>The value of <code>i4</code> is wrong mathematically because associativity required right-to-left. How can I solve this problem? How do I change associativity?     </p>
  
  <p><strong>I got reasonable answers and I learn:</strong>   </p>
  
  <pre><code>-We can't change  associativity or priority of an operator.   
  -Good is Not to overload operators to do something conceptually different to 
   the built-in versions  
  -Even compiler can't support; it hard to implement!  
  </code></pre>