Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Beman committed Oct 30, 2017
2 parents 8a0ab2f + 07619fb commit 44ce5b8
Show file tree
Hide file tree
Showing 10 changed files with 2,969 additions and 18 deletions.
8 changes: 7 additions & 1 deletion doc/release_history.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
</td>
</table>

<h2>1.66.0</h2>
<ul>
<li>Clean up some tutorial example code and fix the wording for it in the
tutorial. Thanks to Anmol-Singh-Jaggi for pull request #11.</li>
</ul>

<h2>1.64.0</h2>
<ul>
<li><code>is_empty()</code>overload with <code>error_code</code> parameter
Expand Down Expand Up @@ -454,7 +460,7 @@ <h2>1.46.0</h2>
</ul>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->03 April, 2017<!--webbot bot="Timestamp" endspan i-checksum="30018" --></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->07 August, 2017<!--webbot bot="Timestamp" endspan i-checksum="34770" --></p>
<p>&copy; Copyright Beman Dawes, 2011</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
Expand Down
36 changes: 23 additions & 13 deletions doc/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -650,15 +650,15 @@ <h2><a name="Using-path-decomposition">Using path decomposition, plus sorting re
{
cout &lt;&lt; p &lt;&lt; &quot; is a directory containing:\n&quot;;

std::vector&lt;std::string&gt; v;
std::vector&lt;path&gt; v;

for (auto&amp;&amp; x : directory_iterator(p))
v.push_back(x.path().filename().string());
v.push_back(x.path());

std::sort(v.begin(), v.end());

for (auto&amp;&amp; x : v)
cout &lt;&lt; &quot; &quot; &lt;&lt; x &lt;&lt; '\n';
cout &lt;&lt; &quot; &quot; &lt;&lt; x.filename() &lt;&lt; '\n';
}
else
cout &lt;&lt; p &lt;&lt; &quot; exists, but is not a regular file or directory\n&quot;;
Expand All @@ -679,21 +679,31 @@ <h2><a name="Using-path-decomposition">Using path decomposition, plus sorting re
</tr>
</table>

<p>The key difference between <code>tut3.cpp</code> and <code>tut4.cpp</code> is
what happens in the directory iteration loop. We changed:</p>
<p>The only difference between <code>tut3.cpp</code> and <code>tut4.cpp</code> is
what happens for directories. We changed:</p>
<blockquote>
<pre>cout &lt;&lt; &quot; &quot; &lt;&lt; *it &lt;&lt; '\n'; // *it returns a <a href="reference.html#Class-directory_entry">directory_entry</a>,</pre>
<pre>for (const directory_entry&amp; x : directory_iterator(p))
cout &lt;&lt; &quot; &quot; &lt;&lt; x.path() &lt;&lt; &#39;\n&#39;;</pre>
</blockquote>
<p>to:</p>
<blockquote>
<pre>path fn = it-&gt;path().filename(); // extract the filename from the path
v.push_back(fn); // push into vector for later sorting</pre>
<pre>std::vector&lt;path&gt; v;

for (auto&amp;&amp; x : directory_iterator(p))
v.push_back(x.path());

std::sort(v.begin(), v.end());

for (auto&amp;&amp; x : v)
cout &lt;&lt; &quot; &quot; &lt;&lt; x.filename() &lt;&lt; &#39;\n&#39;;
</pre>
</blockquote>
<p><code><a href="reference.html#directory_entry-observers">path()</a></code>
is a <code>directory_entry</code> observer function. <code>
<p> <code>
<a href="reference.html#path-filename">filename()</a></code> is one of
several path decomposition functions. It extracts the filename portion (<code>&quot;index.html&quot;</code>)
from a path (<code>&quot;/home/beman/boost/trunk/index.html&quot;</code>). These decomposition functions are
several class <code>path</code> decomposition functions. It extracts the
filename portion
from a path (<font face="Courier New">i.e. </font><code>&quot;index.html&quot;</code><font face="Courier New">
from </font><code>&quot;/home/beman/boost/trunk/index.html&quot;</code>). These decomposition functions are
more fully explored in the <a href="#Class path-iterators-etc">Path iterators, observers,
composition, decomposition and query</a> portion of this tutorial.</p>
<p>The above was written as two lines of code for clarity. It could have
Expand Down Expand Up @@ -1323,7 +1333,7 @@ <h2><a name="Error-reporting">Error reporting</a></h2>
<p>Distributed under the Boost Software License, Version 1.0. See
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a></p>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->26 July 2015<!--webbot bot="Timestamp" endspan i-checksum="18812" --></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->07 August 2017<!--webbot bot="Timestamp" endspan i-checksum="31490" --></p>

</body>

Expand Down
2 changes: 1 addition & 1 deletion example/tut3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main(int argc, char* argv[])
{
cout << p << " is a directory containing:\n";

for (directory_entry& x : directory_iterator(p))
for (const directory_entry& x : directory_iterator(p))
cout << " " << x.path() << '\n';
}
else
Expand Down
6 changes: 3 additions & 3 deletions example/tut4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ int main(int argc, char* argv[])
{
cout << p << " is a directory containing:\n";

std::vector<std::string> v;
std::vector<path> v;

for (auto&& x : directory_iterator(p))
v.push_back(x.path().filename().string());
v.push_back(x.path());

std::sort(v.begin(), v.end());

for (auto&& x : v)
cout << " " << x << '\n';
cout << " " << x.filename() << '\n';
}
else
cout << p << " exists, but is not a regular file or directory\n";
Expand Down
Loading

0 comments on commit 44ce5b8

Please sign in to comment.