title: Solaris CC 12.4 compiler bug?
body: <p>I can use array pointers as iterators in <code>for_each</code> but when I try to do the same using <code>distance</code>, the Solaris 12.4 compiler complains about not finding a match.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;iterator&gt;
  #include &lt;algorithm&gt;
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  
  using std::cout;
  using std::endl;
  using std::hex;
  
  struct Bob {
     char q[16];
  };
  
  Bob stuff[16];
  
  void DoBob(Bob&amp; bob) {
     cout &lt;&lt; "BOB! " &lt;&lt; hex &lt;&lt; &amp;bob &lt;&lt; endl;
  }
  
  
  int main() {
  //   int ret = std::distance(&amp;stuff[0], &amp;stuff[3]);
     // The line above causes the Solaris C++ compiler to complain:
     //"main.cc", line 22: Error: Could not find a match for std::distance&lt;_ForwardIterator, _Distance&gt;(Bob*, Bob*) needed in main().
  
     std::for_each(&amp;stuff[0], &amp;stuff[3], DoBob);
     return 0;
  }
  </code></pre>
  
  <p>I tend not to like to blame the compiler. Am I doing something wrong or is this a problem with the Solaris compiler?</p>