Compare commits

...

8 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
5 changed files with 57 additions and 31 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

@ -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);