Compare commits

...

12 Commits

Author SHA1 Message Date
47854e0ef4 Branch for adding initializer list support (only in the unreleased gcc 4.4 at the moment).
[SVN r48931]
2008-09-23 19:45:43 +00:00
a30a7f9604 With his kind permission, change Jaakko "Järvi" to "Jarvi"
[SVN r46808]
2008-06-28 13:45:21 +00:00
62d366fa68 Link to people pages on the website, as they've been removed from the download.
[SVN r43209]
2008-02-10 14:56:22 +00:00
d08c9bfab1 Update to V2
[SVN r38530]
2007-08-08 19:42:04 +00:00
19b8004830 Fixed a typo.
[SVN r36896]
2007-02-06 00:23:26 +00:00
0af5b76442 Merge fixed links from RC_1_34_0.
[SVN r36660]
2007-01-07 23:50:56 +00:00
defe1c94d6 Add copyright, license
[SVN r35905]
2006-11-07 19:11:57 +00:00
76c2151830 avoid g++ -Wall -W "unused parameter" warnings
[SVN r32373]
2006-01-22 19:29:32 +00:00
2d13a60d05 applied patch by Rupert Kittinger, avoids potentially undefined behavior
[SVN r30690]
2005-08-26 16:03:05 +00:00
9c6ef41dfe Large patch from Ulrich Eckhardt to fix support for EVC++ 4.
[SVN r30670]
2005-08-25 16:27:28 +00:00
5686969287 Merged from 1.33.0 release
[SVN r30540]
2005-08-12 13:02:37 +00:00
a17ce206f2 replaced BOOST_TEST
[SVN r27057]
2005-02-03 13:55:45 +00:00
12 changed files with 92 additions and 99 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;::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;::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;::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="../../../people/jaakko_jarvi.htm"> Jaakko J&auml;rvi</a> 2001.
<p>&copy; Copyright <a href="http://www.boost.org/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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko Jarvi (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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko Jarvi (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, == 1200)
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko Jarvi (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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Jaakko Jarvi (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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Jaakko Jarvi (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 (c!=d) {
if (is.good() && c!=d) {
is.setstate(std::ios::failbit);
}
}
@ -443,7 +443,7 @@ extract_and_check_delimiter(
CharType c;
if (is_delimiter) {
is >> c;
if (c!=d) {
if (is.good() && c!=d) {
is.setstate(std::ios::failbit);
}
}

View File

@ -3,6 +3,11 @@
<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>
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>
</body>
</html>
</html>

View File

@ -1,20 +1,8 @@
subproject libs/tuple/test ;
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)
;
project : requirements <library>/boost/test//boost_test_exec_monitor ;
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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko Jarvi (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 J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko Jarvi (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_TEST (os1.str() == std::string("[1,2,3]") );
BOOST_CHECK (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_TEST (os2.str() == std::string("(TUPU:HUPU:LUPU:4.5)") );
BOOST_CHECK (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_TEST (os1.str() == std::string("[1,2,3][1,2,3]") );
BOOST_CHECK (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_TEST (tmp3.good() );
BOOST_CHECK (tmp3.good() );
#endif
tmp3 >> set_delimiter(':');
tuple<int, int, int> i;
tmp3 >> i;
BOOST_TEST (tmp3.good() );
BOOST_CHECK (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_TEST(bool(is >> ti));
BOOST_TEST(ti == make_tuple(100, 200, 300));
BOOST_CHECK(bool(is >> ti));
BOOST_CHECK(ti == make_tuple(100, 200, 300));
// Note that strings are problematic:

View File

@ -1,4 +1,4 @@
// Copyright (C) 1999, 2000 Jaakko J<EFBFBD>rvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 1999, 2000 Jaakko Jarvi (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_TEST(get<0>(t1) == int());
BOOST_CHECK(get<0>(t1) == int());
tuple<float> t2(5.5f);
BOOST_TEST(get<0>(t2) > 5.4f && get<0>(t2) < 5.6f);
BOOST_CHECK(get<0>(t2) > 5.4f && get<0>(t2) < 5.6f);
tuple<foo> t3(foo(12));
BOOST_TEST(get<0>(t3) == foo(12));
BOOST_CHECK(get<0>(t3) == foo(12));
tuple<double> t4(t2);
BOOST_TEST(get<0>(t4) > 5.4 && get<0>(t4) < 5.6);
BOOST_CHECK(get<0>(t4) > 5.4 && get<0>(t4) < 5.6);
tuple<int, float> t5;
BOOST_TEST(get<0>(t5) == int());
BOOST_TEST(get<1>(t5) == float());
BOOST_CHECK(get<0>(t5) == int());
BOOST_CHECK(get<1>(t5) == float());
tuple<int, float> t6(12, 5.5f);
BOOST_TEST(get<0>(t6) == 12);
BOOST_TEST(get<1>(t6) > 5.4f && get<1>(t6) < 5.6f);
BOOST_CHECK(get<0>(t6) == 12);
BOOST_CHECK(get<1>(t6) > 5.4f && get<1>(t6) < 5.6f);
tuple<int, float> t7(t6);
BOOST_TEST(get<0>(t7) == 12);
BOOST_TEST(get<1>(t7) > 5.4f && get<1>(t7) < 5.6f);
BOOST_CHECK(get<0>(t7) == 12);
BOOST_CHECK(get<1>(t7) > 5.4f && get<1>(t7) < 5.6f);
tuple<long, double> t8(t6);
BOOST_TEST(get<0>(t8) == 12);
BOOST_TEST(get<1>(t8) > 5.4f && get<1>(t8) < 5.6f);
BOOST_CHECK(get<0>(t8) == 12);
BOOST_CHECK(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_TEST(i == 1 && i2 == 2);
BOOST_CHECK(i == 1 && i2 == 2);
int j = get<0>(ct);
BOOST_TEST(j == 1);
BOOST_CHECK(j == 1);
get<0>(t) = 5;
BOOST_TEST(t.head == 5);
BOOST_CHECK(t.head == 5);
// get<0>(ct) = 5; // can't assign to const
double e = get<1>(t);
BOOST_TEST(e > 2.69 && e < 2.71);
BOOST_CHECK(e > 2.69 && e < 2.71);
get<1>(t) = 3.14+i;
BOOST_TEST(get<1>(t) > 4.13 && get<1>(t) < 4.15);
BOOST_CHECK(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_TEST(get<0>(t) == 6);
BOOST_CHECK(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_TEST(get<0>(t1) == get<0>(t2));
BOOST_TEST(get<1>(t1) == get<1>(t2));
BOOST_CHECK(get<0>(t1) == get<0>(t2));
BOOST_CHECK(get<1>(t1) == get<1>(t2));
tuple<long, std::string> t3(2, "a");
t3 = t1;
BOOST_TEST((double)get<0>(t1) == get<0>(t3));
BOOST_TEST(get<1>(t1) == get<1>(t3)[0]);
BOOST_CHECK((double)get<0>(t1) == get<0>(t3));
BOOST_CHECK(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_TEST(i==1);
BOOST_TEST(c=='a');
BOOST_TEST(d>5.4 && d<5.6);
BOOST_CHECK(i==1);
BOOST_CHECK(c=='a');
BOOST_CHECK(d>5.4 && d<5.6);
}
void
@ -256,10 +256,10 @@ mutate_test()
get<2>(t1) = false;
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));
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));
}
// ----------------------------------------------------------------------------
@ -270,13 +270,13 @@ void
make_tuple_test()
{
tuple<int, char> t1 = make_tuple(5, 'a');
BOOST_TEST(get<0>(t1) == 5);
BOOST_TEST(get<1>(t1) == 'a');
BOOST_CHECK(get<0>(t1) == 5);
BOOST_CHECK(get<1>(t1) == 'a');
tuple<int, std::string> t2;
t2 = make_tuple((short int)2, std::string("Hi"));
BOOST_TEST(get<0>(t2) == 2);
BOOST_TEST(get<1>(t2) == "Hi");
BOOST_CHECK(get<0>(t2) == 2);
BOOST_CHECK(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_TEST(make_tuple(2, 4, 6) ==
BOOST_CHECK(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_TEST(a == 2);
BOOST_TEST(b == 'a');
BOOST_TEST(c == foo(3));
BOOST_CHECK(a == 2);
BOOST_CHECK(b == 'a');
BOOST_CHECK(c == foo(3));
tie(a, tuples::ignore, c) = make_tuple((short int)5, false, foo(5));
BOOST_TEST(a == 5);
BOOST_TEST(b == 'a');
BOOST_TEST(c == foo(5));
BOOST_CHECK(a == 5);
BOOST_CHECK(b == 'a');
BOOST_CHECK(c == foo(5));
// testing assignment from std::pair
int i, j;
tie (i, j) = std::make_pair(1, 2);
BOOST_TEST(i == 1 && j == 2);
BOOST_CHECK(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_TEST(t1 == t2);
BOOST_CHECK(t1 == t2);
tuple<int, char> t3(5, 'b');
tuple<int, char> t4(2, 'a');
BOOST_TEST(t1 != t3);
BOOST_TEST(t1 != t4);
BOOST_TEST(!(t1 != t2));
BOOST_CHECK(t1 != t3);
BOOST_CHECK(t1 != t4);
BOOST_CHECK(!(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_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);
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);
}
@ -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_TEST(make_tuple(3,2,1)==c);
BOOST_CHECK(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_TEST(get<0>(t1) == 5);
BOOST_TEST(get<1>(t1) == 3.3f);
BOOST_CHECK(get<0>(t1) == 5);
BOOST_CHECK(get<1>(t1) == 3.3f);
}
// ----------------------------------------------------------------------------