title: homebrew clang and c++11 error: no member named 'cbegin' in 'std::basic_string<char>'
body: <p>[edit2]</p>
  
  <p>Since the answers in the above questions did not help me solve my problem fully, I would like to add this:</p>
  
  <p>When using clang from Homebrew <code>-stdlib=libc++</code> did not work for me. I't could not be found from Hombrew clang. My solution was to build libc++ according to instructions on their web page. And then use <code>clang++ -I/path/to/libcxx/include -L/path/to/libcxx/lib</code> after exporting <code>DYLD_LIBRARY_PATH</code>, also from instructions on libc++ web page.</p>
  
  <p>[/edit2]</p>
  
  <p>[edit]</p>
  
  <p>Looking at the first few comments I see I have an error. But string::const_iterator gives the same error. </p>
  
  <pre><code>error: no member named 'cbegin' in
        'std::basic_string&lt;char&gt;'
      for ( string::const_iterator it = line.cbegin();
  </code></pre>
  
  <p>[/edit]</p>
  
  <p>I am trying to compile the folowing code using -std=c++11. I am using clang 3.2 via homebrew and I am getting the error in the title.</p>
  
  <pre><code>vector&lt;string&gt; extractWords( const string&amp; line ) {
      string tmp;
      vector&lt;string&gt; words;
      int colonCount = 0;
  
      for ( string::iterator it = line.cbegin();
              it != line.end(); ++it ) {
          if ( isprint( *it ) &amp;&amp; !isspace( *it ) ) {
          }
      }
  ...
      return words;
  }
  </code></pre>
  
  <p>Shouldn't this work with c++11?</p>
  
  <p>(sorry about the accidental deletion of the post)</p>