Compare commits

...

15 Commits

Author SHA1 Message Date
fd84aacaae This commit was manufactured by cvs2svn to create tag
'Version_1_29_0'.

[SVN r15904]
2002-10-11 15:17:55 +00:00
95c719cc8c fixing a borland warning
[SVN r15810]
2002-10-08 19:24:36 +00:00
2ee381e6d5 bemans name typo fix + fix to get rid of a borland warning
[SVN r15809]
2002-10-08 18:46:12 +00:00
4dc42b5871 changes from trunk merged to enable MIPSpro compilations
[SVN r15699]
2002-10-03 23:23:54 +00:00
9fa5bc9c6c typo fixes
[SVN r15653]
2002-10-02 16:58:50 +00:00
124d3578a4 Fixes which make it possible to declare with reference elements
[SVN r15532]
2002-09-28 07:25:27 +00:00
a7c8f8f09b markus schöpflin's patch, some portability issues
[SVN r15467]
2002-09-20 16:03:05 +00:00
9c7d17e7a4 This commit was manufactured by cvs2svn to create branch 'RC_1_29_0'.
[SVN r15460]
2002-09-19 20:49:39 +00:00
74a2ab1242 changed jamfile includes from <include> to <sysinclude>
[SVN r15305]
2002-09-13 16:26:12 +00:00
7896766f8f a fix of a fix
[SVN r15278]
2002-09-12 20:59:05 +00:00
0a33edd21d workaround for isspace and metrowerks
[SVN r15277]
2002-09-12 20:50:10 +00:00
53c1bb2c20 removed an extraneous include
[SVN r14993]
2002-08-20 15:54:11 +00:00
ea8d71487d workaround for boost test library problem
[SVN r14992]
2002-08-20 15:51:36 +00:00
6a92d10f25 added a redirection index.html file
[SVN r14898]
2002-08-15 18:26:17 +00:00
3570bdb6b6 fixed some warningns about unused variables, added Jamfile
[SVN r14854]
2002-08-14 20:55:52 +00:00
10 changed files with 118 additions and 39 deletions

View File

@ -264,10 +264,10 @@ A tuple can be copy constructed from another tuple, provided that the element ty
Analogously, a tuple can be assigned to another tuple, provided that the element types are element-wise assignable.
For example:
<pre><code>class A;
<pre><code>class A {};
class B : public A {};
struct C { C(); C(const B&amp;); }
struct D { operator C() const; }
struct C { C(); C(const B&amp;); };
struct D { operator C() const; };
tuple&lt;char, B*, B, D&gt; t;
...
tuple&lt;int, A*, C, C&gt; a(t); // ok

View File

@ -19,7 +19,7 @@
// ( and other bugs ) per suggestion of Jens Maurer
// simplified element type accessors + bug fix (Jeremy Siek)
// Several changes/additions according to suggestions by Doug Gregor,
// William Kempf, Vesa Karvonen, John Max Skaller, Ed Brey, Beman Davis,
// William Kempf, Vesa Karvonen, John Max Skaller, Ed Brey, Beman Dawes,
// David Abrahams.
// Revision history:
@ -108,12 +108,12 @@ struct get_class {
template<class RET, class HT, class TT >
inline static RET get(const cons<HT, TT>& t)
{
return get_class<N-1>::template get<RET>(t.tail);
return get_class<N-1>::BOOST_NESTED_TEMPLATE get<RET>(t.tail);
}
template<class RET, class HT, class TT >
inline static RET get(cons<HT, TT>& t)
{
return get_class<N-1>::template get<RET>(t.tail);
return get_class<N-1>::BOOST_NESTED_TEMPLATE get<RET>(t.tail);
}
};
@ -190,7 +190,7 @@ inline typename access_traits<
typename element<N, cons<HT, TT> >::type
>::non_const_type
get(cons<HT, TT>& c BOOST_TUPLE_DUMMY_PARM) {
return detail::get_class<N>::template
return detail::get_class<N>::BOOST_NESTED_TEMPLATE
get<
typename access_traits<
typename element<N, cons<HT, TT> >::type
@ -205,7 +205,7 @@ inline typename access_traits<
typename element<N, cons<HT, TT> >::type
>::const_type
get(const cons<HT, TT>& c BOOST_TUPLE_DUMMY_PARM) {
return detail::get_class<N>::template
return detail::get_class<N>::BOOST_NESTED_TEMPLATE
get<
typename access_traits<
typename element<N, cons<HT, TT> >::type
@ -332,6 +332,7 @@ struct cons<HT, null_type> {
typedef HT head_type;
typedef null_type tail_type;
typedef cons<HT, null_type> self_type;
typedef typename
detail::wrap_non_storeable_type<head_type>::type stored_head_type;
@ -360,7 +361,7 @@ struct cons<HT, null_type> {
const null_type&, const null_type&, const null_type&)
: head (t1) {}
cons(const null_type& t1,
cons(const null_type&,
const null_type&, const null_type&, const null_type&,
const null_type&, const null_type&, const null_type&,
const null_type&, const null_type&, const null_type&)
@ -379,7 +380,7 @@ struct cons<HT, null_type> {
template <int N>
typename access_traits<
typename element<N, cons>::type
typename element<N, self_type>::type
>::non_const_type
get(BOOST_TUPLE_SINGLE_DUMMY_PARM) {
return boost::tuples::get<N>(*this);
@ -387,7 +388,7 @@ struct cons<HT, null_type> {
template <int N>
typename access_traits<
typename element<N, cons>::type
typename element<N, self_type>::type
>::const_type
get(BOOST_TUPLE_SINGLE_DUMMY_PARM) const {
return boost::tuples::get<N>(*this);

View File

@ -98,6 +98,7 @@ namespace tuples {
}
};
template <typename T> struct add_const_reference : add_reference<typename add_const<T>::type> {};
} // end of namespace detail
// cons builds a heterogenous list of types
@ -108,36 +109,42 @@ namespace tuples {
typedef Head head_type;
typedef Tail tail_type;
private:
typedef typename boost::add_reference<head_type>::type head_ref;
typedef typename boost::add_reference<tail_type>::type tail_ref;
typedef typename detail::add_const_reference<head_type>::type head_cref;
typedef typename detail::add_const_reference<tail_type>::type tail_cref;
public:
head_type head;
tail_type tail;
typename boost::add_reference<head_type>::type get_head() { return head; }
typename boost::add_reference<tail_type>::type get_tail() { return tail; }
head_ref get_head() { return head; }
tail_ref get_tail() { return tail; }
typename boost::add_reference<const head_type>::type get_head() const { return head; }
typename boost::add_reference<const tail_type>::type get_tail() const { return tail; }
head_cref get_head() const { return head; }
tail_cref get_tail() const { return tail; }
#if defined BOOST_MSVC
template<typename Tail>
explicit cons(const head_type& h /* = head_type() */, // causes MSVC 6.5 to barf.
explicit cons(head_cref h /* = head_type() */, // causes MSVC 6.5 to barf.
const Tail& t) : head(h), tail(t.head, t.tail)
{
}
explicit cons(const head_type& h /* = head_type() */, // causes MSVC 6.5 to barf.
explicit cons(head_cref h /* = head_type() */, // causes MSVC 6.5 to barf.
const null_type& t) : head(h), tail(t)
{
}
#else
template<typename T>
explicit cons(const head_type& h, const T& t) :
explicit cons(head_cref h, const T& t) :
head(h), tail(t.head, t.tail)
{
}
explicit cons(const head_type& h = head_type(),
const tail_type& t = tail_type()) :
explicit cons(head_cref h = head_type(),
tail_cref t = tail_type()) :
head(h), tail(t)
{
}
@ -416,20 +423,31 @@ namespace tuples {
typedef typename mapped_tuple::cons2 cons2;
typedef typename mapped_tuple::cons1 cons1;
typedef typename detail::add_const_reference<T1>::type t1_cref;
typedef typename detail::add_const_reference<T2>::type t2_cref;
typedef typename detail::add_const_reference<T3>::type t3_cref;
typedef typename detail::add_const_reference<T4>::type t4_cref;
typedef typename detail::add_const_reference<T5>::type t5_cref;
typedef typename detail::add_const_reference<T6>::type t6_cref;
typedef typename detail::add_const_reference<T7>::type t7_cref;
typedef typename detail::add_const_reference<T8>::type t8_cref;
typedef typename detail::add_const_reference<T9>::type t9_cref;
typedef typename detail::add_const_reference<T10>::type t10_cref;
public:
typedef cons1 inherited;
typedef tuple self_type;
explicit tuple(const T1& t1 = T1(),
const T2& t2 = T2(),
const T3& t3 = T3(),
const T4& t4 = T4(),
const T5& t5 = T5(),
const T6& t6 = T6(),
const T7& t7 = T7(),
const T8& t8 = T8(),
const T9& t9 = T9(),
const T10& t10 = T10()) :
explicit tuple(t1_cref t1 = T1(),
t2_cref t2 = T2(),
t3_cref t3 = T3(),
t4_cref t4 = T4(),
t5_cref t5 = T5(),
t6_cref t6 = T6(),
t7_cref t7 = T7(),
t8_cref t8 = T8(),
t9_cref t9 = T9(),
t10_cref t10 = T10()
) :
cons1(t1, cons2(t2, cons3(t3, cons4(t4, cons5(t5, cons6(t6,cons7(t7,cons8(t8,cons9(t9,cons10(t10))))))))))
{
}

View File

@ -18,6 +18,13 @@
#ifndef BOOST_TUPLE_HPP
#define BOOST_TUPLE_HPP
#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730
// Work around a compiler bug.
// boost::python::tuple has to be seen by the compiler before the
// boost::tuple class template.
namespace boost { namespace python { class tuple; }}
#endif
#include "boost/config.hpp"
#include "boost/static_assert.hpp"

View File

@ -36,6 +36,23 @@
#include "boost/tuple/tuple.hpp"
// This is ugly: one should be using twoargument isspace since whitspace can
// be locale dependent, in theory at least.
// not all libraries implement have the two-arg version, so we need to
// use the one-arg one, which one should get with <cctype> but there seem
// to be exceptions to this.
#if !defined (BOOST_NO_STD_LOCALE)
#include <locale> // for two-arg isspace
#else
#include <cctype> // for one-arg (old) isspace
#include <ctype.h> // Metrowerks does not find one-arg isspace from cctype
#endif
namespace boost {
namespace tuples {
@ -328,7 +345,11 @@ extract_and_check_delimiter(
{
const char d = format_info::get_manipulator(is, del);
const bool is_delimiter = (!isspace(d) );
#if defined (BOOST_NO_STD_LOCALE)
const bool is_delimiter = !isspace(d);
#else
const bool is_delimiter = (!std::isspace(d, is.getloc()) );
#endif
char c;
if (is_delimiter) {
@ -415,7 +436,11 @@ extract_and_check_delimiter(
{
const CharType d = format_info::get_manipulator(is, del);
const bool is_delimiter = (!isspace(d) );
#if defined (BOOST_NO_STD_LOCALE)
const bool is_delimiter = !isspace(d);
#else
const bool is_delimiter = (!std::isspace(d, is.getloc()) );
#endif
CharType c;
if (is_delimiter) {

8
index.html Normal file
View File

@ -0,0 +1,8 @@
<html>
<head>
<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>
</body>
</html>

20
test/Jamfile Normal file
View File

@ -0,0 +1,20 @@
subproject libs/tuple/test ;
unit-test tuple_test_bench
: tuple_test_bench.cpp
<lib>../../test/build/test_exec_monitor
: <sysinclude>$(BOOST_ROOT)
;
unit-test io_test
: io_test.cpp
<lib>../../test/build/test_exec_monitor
: <sysinclude>$(BOOST_ROOT)
;
unit-test another_tuple_test_bench
: another_tuple_test_bench.cpp
<lib>../../test/build/test_exec_monitor
: <sysinclude>$(BOOST_ROOT)
;

View File

@ -94,7 +94,7 @@ void foo4()
A a;
tuple<int, double&, const A&> t(1, d, a);
const tuple<int, double&, const A> ct = t;
(void)ct;
#ifdef E8
get<0>(ct) = 5; // can't assign to const
#endif
@ -119,9 +119,10 @@ void foo4()
void foo5() {
tuple<char, BB*, BB, DD> t;
(void)t;
tuple<char, char> aaa;
tuple<int, int> bbb(aaa);
(void)bbb;
// tuple<int, AA*, CC, CC> a = t;
// a = t;
}

View File

@ -19,8 +19,6 @@
#include <sstream>
#endif
#include "boost/config.hpp"
using namespace std;
using namespace boost;
@ -33,7 +31,8 @@ typedef istringstream useThisIStringStream;
#endif
int test_main(int argc, char * argv[] ) {
(void)argc;
(void)argv;
using boost::tuples::set_close;
using boost::tuples::set_open;
using boost::tuples::set_delimiter;
@ -94,7 +93,7 @@ int test_main(int argc, char * argv[] ) {
useThisIStringStream is("(100 200 300)");
tuple<int, int, int> ti;
BOOST_TEST(is >> ti);
BOOST_TEST(bool(is >> ti));
BOOST_TEST(ti == make_tuple(100, 200, 300));

View File

@ -297,7 +297,7 @@ make_tuple_test()
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
A a; B b;
A a = A(); B b;
const A ca = a;
make_tuple(cref(a), b);
make_tuple(ref(a), b);