mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Integrate Tie with other HTML files
[SVN r7866]
This commit is contained in:
parent
f51ee4ef2e
commit
1f2a827df3
@ -617,7 +617,7 @@ uses the three adaptors.
|
|||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->18 Sep 2000<!--webbot bot="Timestamp" endspan i-checksum="14937" --></p>
|
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->27 Sep 2000<!--webbot bot="Timestamp" endspan i-checksum="14936" --></p>
|
||||||
<p>© Copyright Jeremy Siek 2000. Permission to copy, use,
|
<p>© Copyright Jeremy Siek 2000. Permission to copy, use,
|
||||||
modify, sell and distribute this document is granted provided this copyright
|
modify, sell and distribute this document is granted provided this copyright
|
||||||
notice appears in all copies. This document is provided "as is"
|
notice appears in all copies. This document is provided "as is"
|
||||||
|
@ -585,7 +585,7 @@ complicated than the old one, we think it's worth it to make the library more
|
|||||||
useful in real world. Alexy Gurtovoy contributed the code which supports the new
|
useful in real world. Alexy Gurtovoy contributed the code which supports the new
|
||||||
usage idiom while allowing the library remain backward-compatible.</p>
|
usage idiom while allowing the library remain backward-compatible.</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->24 Sep 2000<!--webbot bot="Timestamp" endspan i-checksum="14930" --></p>
|
<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->27 Sep 2000<!--webbot bot="Timestamp" endspan i-checksum="14936" --></p>
|
||||||
<p>© Copyright David Abrahams and Beman Dawes 1999-2000. Permission to copy,
|
<p>© Copyright David Abrahams and Beman Dawes 1999-2000. Permission to copy,
|
||||||
use, modify, sell and distribute this document is granted provided this
|
use, modify, sell and distribute this document is granted provided this
|
||||||
copyright notice appears in all copies. This document is provided "as
|
copyright notice appears in all copies. This document is provided "as
|
||||||
|
15
tie.html
15
tie.html
@ -31,7 +31,7 @@ tied<A,B> tie(A& a, B& b);
|
|||||||
|
|
||||||
<P>
|
<P>
|
||||||
This is a utility function that makes it more convenient to work with
|
This is a utility function that makes it more convenient to work with
|
||||||
a function which returns a pair. The effect of the <TT>tie()</TT>
|
a function which returns a std::pair<>. The effect of the <TT>tie()</TT>
|
||||||
function is to allow the assignment of the two values of the pair to
|
function is to allow the assignment of the two values of the pair to
|
||||||
two separate variables. The idea for this comes from Jaakko
|
two separate variables. The idea for this comes from Jaakko
|
||||||
Järvi's Binders [<A
|
Järvi's Binders [<A
|
||||||
@ -63,8 +63,7 @@ pair of iterators is assigned to the iterator variables <TT>i</TT> and
|
|||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
<P>
|
<P>
|
||||||
Here is another example that uses <TT>tie()</TT> for handling
|
Here is another example that uses <TT>tie()</TT> for handling operations with <a
|
||||||
operaitons with <a
|
|
||||||
href="http://www.sgi.com/Technology/STL/set.html"><TT>std::set</TT></a>.
|
href="http://www.sgi.com/Technology/STL/set.html"><TT>std::set</TT></a>.
|
||||||
|
|
||||||
<P>
|
<P>
|
||||||
@ -92,9 +91,9 @@ main(int, char*[])
|
|||||||
for (int k = 0; k < 2; ++k) {
|
for (int k = 0; k < 2; ++k) {
|
||||||
boost::tie(i,inserted) = s.insert(new_vals[k]);
|
boost::tie(i,inserted) = s.insert(new_vals[k]);
|
||||||
if (!inserted)
|
if (!inserted)
|
||||||
std::cout << *i << " was already in the set." << std::endl;
|
std::cout << *i << " was already in the set." << std::endl;
|
||||||
else
|
else
|
||||||
std::cout << *i << " successfully inserted." << std::endl;
|
std::cout << *i << " successfully inserted." << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -105,8 +104,8 @@ main(int, char*[])
|
|||||||
// Using tie() with a return value of pair<iterator,iterator>
|
// Using tie() with a return value of pair<iterator,iterator>
|
||||||
|
|
||||||
boost::tie(i,end) = std::equal_range(vals, vals + 6, 4);
|
boost::tie(i,end) = std::equal_range(vals, vals + 6, 4);
|
||||||
std::cout << "There were " << std::distance(i,end)
|
std::cout << "There were " << std::distance(i,end)
|
||||||
<< " occurances of " << *i << "." << std::endl;
|
<< " occurrences of " << *i << "." << std::endl;
|
||||||
// Footnote: of course one would normally just use std::count()
|
// Footnote: of course one would normally just use std::count()
|
||||||
// to get this information, but that would spoil the example :)
|
// to get this information, but that would spoil the example :)
|
||||||
}
|
}
|
||||||
@ -117,7 +116,7 @@ The output is:
|
|||||||
<PRE>
|
<PRE>
|
||||||
3 successfully inserted.
|
3 successfully inserted.
|
||||||
9 was already in the set.
|
9 was already in the set.
|
||||||
There were 2 occurances of 4.
|
There were 2 occurrences of 4.
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
<h2>Contents</h2>
|
<h2>Contents</h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Template functions <a href="#functions next">next() and prior()</a></li>
|
<li>Function templates <a href="#functions next">next() and prior()</a></li>
|
||||||
<li>Class <a href="#Class noncopyable">noncopyable</a></li>
|
<li>Class <a href="#Class noncopyable">noncopyable</a></li>
|
||||||
|
<li>Function template <a href="tie.html">tie()</a> and supporting class tied.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2>Template <a name="functions next">functions next</a>() and prior()</h2>
|
<h2> <a name="functions next">Function</a> templates next() and prior()</h2>
|
||||||
|
|
||||||
<p>Certain data types, such as the C++ Standard Library's forward and
|
<p>Certain data types, such as the C++ Standard Library's forward and
|
||||||
bidirectional iterators, do not provide addition and subtraction via operator+()
|
bidirectional iterators, do not provide addition and subtraction via operator+()
|
||||||
@ -92,7 +93,7 @@ destructor declarations. He says "Probably this concern is misplaced, becau
|
|||||||
noncopyable will be used mostly for classes which own resources and thus have non-trivial destruction semantics."</p>
|
noncopyable will be used mostly for classes which own resources and thus have non-trivial destruction semantics."</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan
|
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan
|
||||||
-->26 January, 2000<!--webbot bot="Timestamp" endspan i-checksum="38194"
|
-->28 September, 2000<!--webbot bot="Timestamp" endspan i-checksum="39343"
|
||||||
-->
|
-->
|
||||||
</p>
|
</p>
|
||||||
<p>© Copyright boost.org 1999. Permission to copy, use, modify, sell and
|
<p>© Copyright boost.org 1999. Permission to copy, use, modify, sell and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user