Compare commits

..

1 Commits

Author SHA1 Message Date
ed85e2b23f This commit was manufactured by cvs2svn to create branch 'RC_1_32_0'.
[SVN r25797]
2004-10-20 08:26:43 +00:00
12 changed files with 99 additions and 92 deletions

View File

@ -101,7 +101,7 @@ For a one-element cons list the tail argument (<code>null_type</code>) can be om
<p>
The template <code>access_traits</code> defines three type functions. Let <code>T</code> be a type of an element in a tuple:
<ol>
<li><code>access_traits&lt;T&gt;::non_const_type</code> maps <code>T</code> to the return type of the non-const access functions (nonmeber and member <code>get</code> functions, and the <code>get_head</code> function).</li>
<li><code>access_traits&lt;T&gt;::type</code> maps <code>T</code> to the return type of the non-const access functions (nonmeber and member <code>get</code> functions, and the <code>get_head</code> function).</li>
<li><code>access_traits&lt;T&gt;::const_type</code> maps <code>T</code> to the return type of the const access functions.</li>
<li><code>access_traits&lt;T&gt;::parameter_type</code> maps <code>T</code> to the parameter type of the tuple constructor.</li>
</ol>

View File

@ -500,12 +500,12 @@ The idea for the tie mechanism came from an old usenet article by Ian McCulloch,
<p>
<a name="publ_1"></a>[1]
J&auml;rvi J.: <i>Tuples and multiple return values in C++</i>, TUCS Technical Report No 249, 1999<!-- (<a href="http://www.tucs.fi/Publications">http://www.tucs.fi/Publications</a>)-->.
J&auml;rvi J.: <i>Tuples and multiple return values in C++</i>, TUCS Technical Report No 249, 1999 (<a href="http://www.tucs.fi/Publications">http://www.tucs.fi/Publications</a>).
</p>
<p>
<a name="publ_2"></a>[2]
J&auml;rvi J.: <i>ML-Style Tuple Assignment in Standard C++ - Extending the Multiple Return Value Formalism</i>, TUCS Technical Report No 267, 1999<!-- (<a href="http://www.tucs.fi/Publications">http://www.tucs.fi/Publications</a>)-->.
J&auml;rvi J.: <i>ML-Style Tuple Assignment in Standard C++ - Extending the Multiple Return Value Formalism</i>, TUCS Technical Report No 267, 1999 (<a href="http://www.tucs.fi/Publications">http://www.tucs.fi/Publications</a>).
</p>
<p>
@ -516,7 +516,7 @@ J&auml;rvi J.: <i>ML-Style Tuple Assignment in Standard C++ - Extending the Mult
<p>Last modified 2003-09-07</p>
<p>&copy; Copyright <a href="http://www.boost.org/people/jaakko_jarvi.htm"> Jaakko J&auml;rvi</a> 2001.
<p>&copy; Copyright <a href="../../../people/jaakko_jarvi.htm"> Jaakko J&auml;rvi</a> 2001.
Permission to copy, use, modify, sell and distribute this software and its documentation is granted provided this copyright notice appears in all copies.
This software and its documentation is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

View File

@ -1,6 +1,6 @@
// tuple_basic.hpp -----------------------------------------------------
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@ -362,7 +362,7 @@ struct cons {
template <class T2, class T3, class T4, class T5,
class T6, class T7, class T8, class T9, class T10>
cons( const null_type& /*t1*/, T2& t2, T3& t3, T4& t4, T5& t5,
cons( const null_type& t1, T2& t2, T3& t3, T4& t4, T5& t5,
T6& t6, T7& t7, T8& t8, T9& t9, T10& t10 )
: head (),
tail (t2, t3, t4, t5, t6, t7, t8, t9, t10, detail::cnull())

View File

@ -1,6 +1,6 @@
// - tuple_basic_no_partial_spec.hpp -----------------------------------------
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Douglas Gregor (gregod@rpi.edu)
// Copyright (C) 2001 Gary Powell (gary.powell@sierra.com)
//
@ -105,7 +105,7 @@ namespace tuples {
// Each of vc6 and vc7 seem to require a different formulation
// of this return type
template <class H, class T>
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
#if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
static typename add_reference<typename add_const<T>::type>::type
#else
static typename add_const_reference<T>::type

View File

@ -1,6 +1,6 @@
// tuple.hpp - Boost Tuple Library --------------------------------------
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,6 +1,6 @@
// tuple_comparison.hpp -----------------------------------------------------
//
// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Gary Powell (gary.powell@sierra.com)
//
// Distributed under the Boost Software License, Version 1.0. (See

View File

@ -1,6 +1,6 @@
// tuple_io.hpp --------------------------------------------------------------
// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// 2001 Gary Powell (gary.powell@sierra.com)
//
// Distributed under the Boost Software License, Version 1.0. (See
@ -349,7 +349,7 @@ extract_and_check_delimiter(
char c;
if (is_delimiter) {
is >> c;
if (is.good() && c!=d) {
if (c!=d) {
is.setstate(std::ios::failbit);
}
}
@ -443,7 +443,7 @@ extract_and_check_delimiter(
CharType c;
if (is_delimiter) {
is >> c;
if (is.good() && c!=d) {
if (c!=d) {
is.setstate(std::ios::failbit);
}
}

View File

@ -3,11 +3,6 @@
<meta http-equiv="refresh" content="0; URL=doc/tuple_users_guide.html">
</head>
<body>
Automatic redirection failed, please go to <a href="doc/tuple_users_guide.html">doc/tuple_users_guide.html</a>
&nbsp;<hr>
<p><EFBFBD> Copyright Beman Dawes, 2001</p>
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
Automatic redirection failed, please go to <a href="doc/tuple_users_guide.html">doc/tuple_users_guide.html</a>
</body>
</html>
</html>

View File

@ -1,8 +1,20 @@
subproject libs/tuple/test ;
project : requirements <library>/boost/test//boost_test_exec_monitor ;
unit-test tuple_test_bench
: tuple_test_bench.cpp
<lib>../../test/build/boost_test_exec_monitor
: <sysinclude>$(BOOST_ROOT)
;
unit-test io_test
: io_test.cpp
<lib>../../test/build/boost_test_exec_monitor
: <sysinclude>$(BOOST_ROOT)
;
unit-test another_tuple_test_bench
: another_tuple_test_bench.cpp
<lib>../../test/build/boost_test_exec_monitor
: <sysinclude>$(BOOST_ROOT)
;
test-suite tuple :
[ run tuple_test_bench.cpp ]
[ run io_test.cpp ]
[ run another_tuple_test_bench.cpp ]
;

View File

@ -1,4 +1,4 @@
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,4 +1,4 @@
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@ -52,7 +52,7 @@ int test_main(int argc, char * argv[] ) {
os1 << set_close(']');
os1 << set_delimiter(',');
os1 << make_tuple(1, 2, 3);
BOOST_CHECK (os1.str() == std::string("[1,2,3]") );
BOOST_TEST (os1.str() == std::string("[1,2,3]") );
{
useThisOStringStream os2;
@ -62,13 +62,13 @@ int test_main(int argc, char * argv[] ) {
os2 << set_delimiter(':');
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
os2 << make_tuple("TUPU", "HUPU", "LUPU", 4.5);
BOOST_CHECK (os2.str() == std::string("(TUPU:HUPU:LUPU:4.5)") );
BOOST_TEST (os2.str() == std::string("(TUPU:HUPU:LUPU:4.5)") );
#endif
}
// The format is still [a, b, c] for os1
os1 << make_tuple(1, 2, 3);
BOOST_CHECK (os1.str() == std::string("[1,2,3][1,2,3]") );
BOOST_TEST (os1.str() == std::string("[1,2,3][1,2,3]") );
ofstream tmp("temp.tmp");
@ -86,13 +86,13 @@ int test_main(int argc, char * argv[] ) {
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
tmp3 >> j;
BOOST_CHECK (tmp3.good() );
BOOST_TEST (tmp3.good() );
#endif
tmp3 >> set_delimiter(':');
tuple<int, int, int> i;
tmp3 >> i;
BOOST_CHECK (tmp3.good() );
BOOST_TEST (tmp3.good() );
tmp3.close();
@ -101,8 +101,8 @@ int test_main(int argc, char * argv[] ) {
useThisIStringStream is("(100 200 300)");
tuple<int, int, int> ti;
BOOST_CHECK(bool(is >> ti));
BOOST_CHECK(ti == make_tuple(100, 200, 300));
BOOST_TEST(bool(is >> ti));
BOOST_TEST(ti == make_tuple(100, 200, 300));
// Note that strings are problematic:

View File

@ -1,4 +1,4 @@
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@ -107,32 +107,32 @@ construction_test()
// MSVC 6.0 just cannot find get without the namespace qualifier
tuple<int> t1;
BOOST_CHECK(get<0>(t1) == int());
BOOST_TEST(get<0>(t1) == int());
tuple<float> t2(5.5f);
BOOST_CHECK(get<0>(t2) > 5.4f && get<0>(t2) < 5.6f);
BOOST_TEST(get<0>(t2) > 5.4f && get<0>(t2) < 5.6f);
tuple<foo> t3(foo(12));
BOOST_CHECK(get<0>(t3) == foo(12));
BOOST_TEST(get<0>(t3) == foo(12));
tuple<double> t4(t2);
BOOST_CHECK(get<0>(t4) > 5.4 && get<0>(t4) < 5.6);
BOOST_TEST(get<0>(t4) > 5.4 && get<0>(t4) < 5.6);
tuple<int, float> t5;
BOOST_CHECK(get<0>(t5) == int());
BOOST_CHECK(get<1>(t5) == float());
BOOST_TEST(get<0>(t5) == int());
BOOST_TEST(get<1>(t5) == float());
tuple<int, float> t6(12, 5.5f);
BOOST_CHECK(get<0>(t6) == 12);
BOOST_CHECK(get<1>(t6) > 5.4f && get<1>(t6) < 5.6f);
BOOST_TEST(get<0>(t6) == 12);
BOOST_TEST(get<1>(t6) > 5.4f && get<1>(t6) < 5.6f);
tuple<int, float> t7(t6);
BOOST_CHECK(get<0>(t7) == 12);
BOOST_CHECK(get<1>(t7) > 5.4f && get<1>(t7) < 5.6f);
BOOST_TEST(get<0>(t7) == 12);
BOOST_TEST(get<1>(t7) > 5.4f && get<1>(t7) < 5.6f);
tuple<long, double> t8(t6);
BOOST_CHECK(get<0>(t8) == 12);
BOOST_CHECK(get<1>(t8) > 5.4f && get<1>(t8) < 5.6f);
BOOST_TEST(get<0>(t8) == 12);
BOOST_TEST(get<1>(t8) > 5.4f && get<1>(t8) < 5.6f);
dummy(
tuple<no_def_constructor, no_def_constructor, no_def_constructor>(
@ -175,27 +175,27 @@ void element_access_test()
int i = get<0>(t);
int i2 = get<3>(t);
BOOST_CHECK(i == 1 && i2 == 2);
BOOST_TEST(i == 1 && i2 == 2);
int j = get<0>(ct);
BOOST_CHECK(j == 1);
BOOST_TEST(j == 1);
get<0>(t) = 5;
BOOST_CHECK(t.head == 5);
BOOST_TEST(t.head == 5);
// get<0>(ct) = 5; // can't assign to const
double e = get<1>(t);
BOOST_CHECK(e > 2.69 && e < 2.71);
BOOST_TEST(e > 2.69 && e < 2.71);
get<1>(t) = 3.14+i;
BOOST_CHECK(get<1>(t) > 4.13 && get<1>(t) < 4.15);
BOOST_TEST(get<1>(t) > 4.13 && get<1>(t) < 4.15);
// get<4>(t) = A(); // can't assign to const
// dummy(get<5>(ct)); // illegal index
++get<0>(t);
BOOST_CHECK(get<0>(t) == 6);
BOOST_TEST(get<0>(t) == 6);
BOOST_STATIC_ASSERT((boost::is_const<boost::tuples::element<0, tuple<int, float> >::type>::value != true));
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
@ -224,13 +224,13 @@ copy_test()
tuple<int, char> t1(4, 'a');
tuple<int, char> t2(5, 'b');
t2 = t1;
BOOST_CHECK(get<0>(t1) == get<0>(t2));
BOOST_CHECK(get<1>(t1) == get<1>(t2));
BOOST_TEST(get<0>(t1) == get<0>(t2));
BOOST_TEST(get<1>(t1) == get<1>(t2));
tuple<long, std::string> t3(2, "a");
t3 = t1;
BOOST_CHECK((double)get<0>(t1) == get<0>(t3));
BOOST_CHECK(get<1>(t1) == get<1>(t3)[0]);
BOOST_TEST((double)get<0>(t1) == get<0>(t3));
BOOST_TEST(get<1>(t1) == get<1>(t3)[0]);
// testing copy and assignment with implicit conversions between elements
// testing tie
@ -242,9 +242,9 @@ copy_test()
int i; char c; double d;
tie(i, c, d) = make_tuple(1, 'a', 5.5);
BOOST_CHECK(i==1);
BOOST_CHECK(c=='a');
BOOST_CHECK(d>5.4 && d<5.6);
BOOST_TEST(i==1);
BOOST_TEST(c=='a');
BOOST_TEST(d>5.4 && d<5.6);
}
void
@ -256,10 +256,10 @@ mutate_test()
get<2>(t1) = false;
get<3>(t1) = foo(5);
BOOST_CHECK(get<0>(t1) == 6);
BOOST_CHECK(get<1>(t1) > 2.1f && get<1>(t1) < 2.3f);
BOOST_CHECK(get<2>(t1) == false);
BOOST_CHECK(get<3>(t1) == foo(5));
BOOST_TEST(get<0>(t1) == 6);
BOOST_TEST(get<1>(t1) > 2.1f && get<1>(t1) < 2.3f);
BOOST_TEST(get<2>(t1) == false);
BOOST_TEST(get<3>(t1) == foo(5));
}
// ----------------------------------------------------------------------------
@ -270,13 +270,13 @@ void
make_tuple_test()
{
tuple<int, char> t1 = make_tuple(5, 'a');
BOOST_CHECK(get<0>(t1) == 5);
BOOST_CHECK(get<1>(t1) == 'a');
BOOST_TEST(get<0>(t1) == 5);
BOOST_TEST(get<1>(t1) == 'a');
tuple<int, std::string> t2;
t2 = make_tuple((short int)2, std::string("Hi"));
BOOST_CHECK(get<0>(t2) == 2);
BOOST_CHECK(get<1>(t2) == "Hi");
BOOST_TEST(get<0>(t2) == 2);
BOOST_TEST(get<1>(t2) == "Hi");
A a = A(); B b;
@ -288,7 +288,7 @@ make_tuple_test()
make_tuple(boost::ref(ca));
// the result of make_tuple is assignable:
BOOST_CHECK(make_tuple(2, 4, 6) ==
BOOST_TEST(make_tuple(2, 4, 6) ==
(make_tuple(1, 2, 3) = make_tuple(2, 4, 6)));
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
@ -336,19 +336,19 @@ tie_test()
foo c(5);
tie(a, b, c) = make_tuple(2, 'a', foo(3));
BOOST_CHECK(a == 2);
BOOST_CHECK(b == 'a');
BOOST_CHECK(c == foo(3));
BOOST_TEST(a == 2);
BOOST_TEST(b == 'a');
BOOST_TEST(c == foo(3));
tie(a, tuples::ignore, c) = make_tuple((short int)5, false, foo(5));
BOOST_CHECK(a == 5);
BOOST_CHECK(b == 'a');
BOOST_CHECK(c == foo(5));
BOOST_TEST(a == 5);
BOOST_TEST(b == 'a');
BOOST_TEST(c == foo(5));
// testing assignment from std::pair
int i, j;
tie (i, j) = std::make_pair(1, 2);
BOOST_CHECK(i == 1 && j == 2);
BOOST_TEST(i == 1 && j == 2);
tuple<int, int, float> ta;
#ifdef E11
@ -368,13 +368,13 @@ equality_test()
{
tuple<int, char> t1(5, 'a');
tuple<int, char> t2(5, 'a');
BOOST_CHECK(t1 == t2);
BOOST_TEST(t1 == t2);
tuple<int, char> t3(5, 'b');
tuple<int, char> t4(2, 'a');
BOOST_CHECK(t1 != t3);
BOOST_CHECK(t1 != t4);
BOOST_CHECK(!(t1 != t2));
BOOST_TEST(t1 != t3);
BOOST_TEST(t1 != t4);
BOOST_TEST(!(t1 != t2));
}
@ -388,14 +388,14 @@ ordering_test()
tuple<int, float> t1(4, 3.3f);
tuple<short, float> t2(5, 3.3f);
tuple<long, double> t3(5, 4.4);
BOOST_CHECK(t1 < t2);
BOOST_CHECK(t1 <= t2);
BOOST_CHECK(t2 > t1);
BOOST_CHECK(t2 >= t1);
BOOST_CHECK(t2 < t3);
BOOST_CHECK(t2 <= t3);
BOOST_CHECK(t3 > t2);
BOOST_CHECK(t3 >= t2);
BOOST_TEST(t1 < t2);
BOOST_TEST(t1 <= t2);
BOOST_TEST(t2 > t1);
BOOST_TEST(t2 >= t1);
BOOST_TEST(t2 < t3);
BOOST_TEST(t2 <= t3);
BOOST_TEST(t3 > t2);
BOOST_TEST(t3 >= t2);
}
@ -412,7 +412,7 @@ void cons_test()
cons<const int, cons<volatile float, null_type> > b(2,a);
int i = 3;
cons<int&, cons<const int, cons<volatile float, null_type> > > c(i, b);
BOOST_CHECK(make_tuple(3,2,1)==c);
BOOST_TEST(make_tuple(3,2,1)==c);
cons<char, cons<int, cons<float, null_type> > > x;
dummy(x);
@ -424,8 +424,8 @@ void cons_test()
void const_tuple_test()
{
const tuple<int, float> t1(5, 3.3f);
BOOST_CHECK(get<0>(t1) == 5);
BOOST_CHECK(get<1>(t1) == 3.3f);
BOOST_TEST(get<0>(t1) == 5);
BOOST_TEST(get<1>(t1) == 3.3f);
}
// ----------------------------------------------------------------------------