mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Removed obsolete references to utility/tie
[SVN r19902]
This commit is contained in:
parent
953cc46220
commit
7dd7daee1b
@ -21,14 +21,13 @@
|
||||
<a href="compressed_pair.htm">compressed_pair</a><br>
|
||||
<a href="iterator_adaptors.htm">iterator_adaptors</a><br>
|
||||
<a href="operators.htm">operators</a><br>
|
||||
<a href="tie.html">tie</a><br>
|
||||
<a href="throw_exception.html">throw_exception</a><br>
|
||||
<a href="utility.htm">utility</a><br>
|
||||
<a href="value_init.htm">value_init</a></p>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<p>Revised
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->09 January, 2003<!--webbot bot="Timestamp" endspan i-checksum="38582" --></p>
|
||||
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->01 September, 2003<!--webbot bot="Timestamp" endspan i-checksum="38582" --></p>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
143
tie.html
143
tie.html
@ -1,143 +0,0 @@
|
||||
<HTML>
|
||||
<!--
|
||||
-- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
|
||||
--
|
||||
-- Permission to use, copy, modify, distribute and sell this software
|
||||
-- and its documentation for any purpose is hereby granted without fee,
|
||||
-- provided that the above copyright notice appears in all copies and
|
||||
-- that both that copyright notice and this permission notice appear
|
||||
-- in supporting documentation. We make no
|
||||
-- representations about the suitability of this software for any
|
||||
-- purpose. It is provided "as is" without express or implied warranty.
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Tie</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../c++boost.gif"
|
||||
ALT="C++ Boost" width="277" height="86">
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:tie"></A>
|
||||
<TT>tie</TT>
|
||||
</H1>
|
||||
|
||||
<h3>
|
||||
[This version of tie has been removed from the utility.hpp
|
||||
header. There is a new, more general version of <a
|
||||
href="../tuple/doc/tuple_users_guide.html#tiers">tie</a> in the Boost
|
||||
Tuples Library. The more general version handles an (almost) arbitrary
|
||||
number of arguments, instead of just two. The version in utility.hpp
|
||||
had to be removed to avoid name clashes.]</h3>
|
||||
<PRE>
|
||||
template <class A, class B>
|
||||
tied<A,B> tie(A& a, B& b);
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
This is a utility function that makes it more convenient to work with
|
||||
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
|
||||
two separate variables. The idea for this comes from Jaakko
|
||||
Järvi's Binders [<A
|
||||
HREF="../graph/doc/bibliography.html#jaakko_tuple_assign">1</A>].
|
||||
|
||||
<P>
|
||||
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../boost/utility.hpp"><TT>boost/utility.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
<H3>Example</H3>
|
||||
|
||||
<P>
|
||||
An example of using the <TT>tie()</TT> function with the
|
||||
<TT>vertices()</TT> function, which returns a pair of
|
||||
type <TT>std::pair<vertex_iterator,vertex_iterator></TT>. The
|
||||
pair of iterators is assigned to the iterator variables <TT>i</TT> and
|
||||
<TT>end</TT>.
|
||||
|
||||
<P>
|
||||
<PRE>
|
||||
graph_traits< adjacency_list<> >::vertex_iterator i, end;
|
||||
for(tie(i,end) = vertices(G); i != end; ++i)
|
||||
// ...
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
Here is another example that uses <TT>tie()</TT> for handling operations with <a
|
||||
href="http://www.sgi.com/tech/stl/set.html"><TT>std::set</TT></a>.
|
||||
|
||||
<P>
|
||||
<PRE>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
int
|
||||
main(int, char*[])
|
||||
{
|
||||
{
|
||||
typedef std::set<int> SetT;
|
||||
SetT::iterator i, end;
|
||||
bool inserted;
|
||||
|
||||
int vals[5] = { 5, 2, 4, 9, 1 };
|
||||
SetT s(vals, vals + 5);
|
||||
|
||||
// Using tie() with a return value of pair<iterator,bool>
|
||||
|
||||
int new_vals[2] = { 3, 9 };
|
||||
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
boost::tie(i,inserted) = s.insert(new_vals[k]);
|
||||
if (!inserted)
|
||||
std::cout << *i << " was already in the set." << std::endl;
|
||||
else
|
||||
std::cout << *i << " successfully inserted." << std::endl;
|
||||
}
|
||||
}
|
||||
{
|
||||
int* i, *end;
|
||||
int vals[6] = { 5, 2, 4, 4, 9, 1 };
|
||||
std::sort(vals, vals + 6);
|
||||
|
||||
// Using tie() with a return value of pair<iterator,iterator>
|
||||
|
||||
boost::tie(i,end) = std::equal_range(vals, vals + 6, 4);
|
||||
std::cout << "There were " << std::distance(i,end)
|
||||
<< " occurrences of " << *i << "." << std::endl;
|
||||
// Footnote: of course one would normally just use std::count()
|
||||
// to get this information, but that would spoil the example :)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
</PRE>
|
||||
The output is:
|
||||
<PRE>
|
||||
3 successfully inserted.
|
||||
9 was already in the set.
|
||||
There were 2 occurrences of 4.
|
||||
</PRE>
|
||||
|
||||
<br>
|
||||
<HR>
|
||||
<TABLE>
|
||||
<TR valign=top>
|
||||
<TD nowrap>Copyright © 2000</TD><TD>
|
||||
<a HREF="../../people/jeremy_siek.htm">Jeremy Siek</a>,
|
||||
Univ.of Notre Dame (<A
|
||||
HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)<br>
|
||||
<A HREF=http://www.lsc.nd.edu/~llee1>Lie-Quan Lee</A>, Univ.of Notre Dame (<A HREF="mailto:llee1@lsc.nd.edu">llee1@lsc.nd.edu</A>)<br>
|
||||
<A HREF=http://www.lsc.nd.edu/~lums>Andrew Lumsdaine</A>,
|
||||
Univ.of Notre Dame (<A
|
||||
HREF="mailto:lums@lsc.nd.edu">lums@lsc.nd.edu</A>)
|
||||
</TD></TR></TABLE>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
@ -1,64 +0,0 @@
|
||||
// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,
|
||||
// sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
//
|
||||
// This is an example demonstrating how to use the tie() function.
|
||||
// The purpose of tie() is to make it easiery to deal with std::pair
|
||||
// return values.
|
||||
//
|
||||
// Contributed by Jeremy Siek
|
||||
//
|
||||
// Sample output
|
||||
//
|
||||
// 3 successfully inserted.
|
||||
// 9 was already in the set.
|
||||
// There were 2 occurrences of 4.
|
||||
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator> // std::distance
|
||||
// Note: tie() use to live in boost/utility.hpp, but
|
||||
// not it is part of the more general Boost Tuple Library.
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
int
|
||||
main(int, char*[])
|
||||
{
|
||||
{
|
||||
typedef std::set<int> SetT;
|
||||
SetT::iterator i;
|
||||
bool inserted;
|
||||
|
||||
int vals[5] = { 5, 2, 4, 9, 1 };
|
||||
SetT s(vals, vals + 5);
|
||||
|
||||
// Using tie() with a return value of pair<iterator,bool>
|
||||
|
||||
int new_vals[2] = { 3, 9 };
|
||||
|
||||
for (int k = 0; k < 2; ++k) {
|
||||
boost::tie(i,inserted) = s.insert(new_vals[k]);
|
||||
if (!inserted)
|
||||
std::cout << *i << " was already in the set." << std::endl;
|
||||
else
|
||||
std::cout << *i << " successfully inserted." << std::endl;
|
||||
}
|
||||
}
|
||||
{
|
||||
int* i, *end;
|
||||
int vals[6] = { 5, 2, 4, 4, 9, 1 };
|
||||
std::sort(vals, vals + 6);
|
||||
|
||||
// Using tie() with a return value of pair<iterator,iterator>
|
||||
|
||||
boost::tie(i,end) = std::equal_range(vals, vals + 6, 4);
|
||||
std::cout << "There were " << std::distance(i,end)
|
||||
<< " occurrences of " << *i << "." << std::endl;
|
||||
// Footnote: of course one would normally just use std::count()
|
||||
// to get this information, but that would spoil the example :)
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -22,8 +22,6 @@
|
||||
Class <a href="#Class_noncopyable">noncopyable</a></li>
|
||||
<li>
|
||||
Function template <a href="#addressof">addressof()</a></li>
|
||||
<li>
|
||||
Function template <a href="tie.html">tie()</a> and supporting class tied.</li>
|
||||
</ul>
|
||||
<h2>
|
||||
Function templates <a name="checked_delete">checked_delete</a>() and
|
||||
@ -122,14 +120,12 @@ void f() {
|
||||
</blockquote>
|
||||
<h2>Class templates for the Base-from-Member Idiom</h2>
|
||||
<p>See <a href="base_from_member.html">separate documentation</a>.</p>
|
||||
<h2>Function template tie()</h2>
|
||||
<p>See <a href="tie.html">separate documentation</a>.</p>
|
||||
<hr>
|
||||
<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan
|
||||
-->09 January, 2003<!--webbot bot="Timestamp" endspan i-checksum="38582"
|
||||
-->01 September, 2003<!--webbot bot="Timestamp" endspan i-checksum="38582"
|
||||
-->
|
||||
</p>
|
||||
<p>© Copyright boost.org 1999-2002. Permission to copy, use, modify, sell and distribute
|
||||
<p>© Copyright boost.org 1999-2003. Permission to copy, use, modify, sell and distribute
|
||||
this document is granted provided this copyright notice appears in all copies.
|
||||
This document is provided "as is" without express or implied
|
||||
warranty, and with no claim as to its suitability for any purpose.</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user