Compare commits

..

2 Commits

Author SHA1 Message Date
86502276c3 This commit was manufactured by cvs2svn to create tag
'Version_1_28_0'.

[SVN r13949]
2002-05-16 13:26:18 +00:00
5f6c33b4a8 This commit was manufactured by cvs2svn to create branch 'RC_1_28_0'.
[SVN r13795]
2002-05-10 04:34:27 +00:00
11 changed files with 42 additions and 122 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 Dawes,
// William Kempf, Vesa Karvonen, John Max Skaller, Ed Brey, Beman Davis,
// 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>::BOOST_NESTED_TEMPLATE get<RET>(t.tail);
return get_class<N-1>::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>::BOOST_NESTED_TEMPLATE get<RET>(t.tail);
return get_class<N-1>::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>::BOOST_NESTED_TEMPLATE
return detail::get_class<N>::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>::BOOST_NESTED_TEMPLATE
return detail::get_class<N>::template
get<
typename access_traits<
typename element<N, cons<HT, TT> >::type
@ -332,7 +332,6 @@ 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;
@ -361,7 +360,7 @@ struct cons<HT, null_type> {
const null_type&, const null_type&, const null_type&)
: head (t1) {}
cons(const null_type&,
cons(const null_type& t1,
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&)
@ -380,7 +379,7 @@ struct cons<HT, null_type> {
template <int N>
typename access_traits<
typename element<N, self_type>::type
typename element<N, cons>::type
>::non_const_type
get(BOOST_TUPLE_SINGLE_DUMMY_PARM) {
return boost::tuples::get<N>(*this);
@ -388,7 +387,7 @@ struct cons<HT, null_type> {
template <int N>
typename access_traits<
typename element<N, self_type>::type
typename element<N, cons>::type
>::const_type
get(BOOST_TUPLE_SINGLE_DUMMY_PARM) const {
return boost::tuples::get<N>(*this);

View File

@ -98,7 +98,6 @@ 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
@ -109,42 +108,36 @@ 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;
head_ref get_head() { return head; }
tail_ref get_tail() { return tail; }
typename boost::add_reference<head_type>::type get_head() { return head; }
typename boost::add_reference<tail_type>::type get_tail() { return tail; }
head_cref get_head() const { return head; }
tail_cref get_tail() const { 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; }
#if defined BOOST_MSVC
template<typename Tail>
explicit cons(head_cref h /* = head_type() */, // causes MSVC 6.5 to barf.
explicit cons(const head_type& h /* = head_type() */, // causes MSVC 6.5 to barf.
const Tail& t) : head(h), tail(t.head, t.tail)
{
}
explicit cons(head_cref h /* = head_type() */, // causes MSVC 6.5 to barf.
explicit cons(const head_type& h /* = head_type() */, // causes MSVC 6.5 to barf.
const null_type& t) : head(h), tail(t)
{
}
#else
template<typename T>
explicit cons(head_cref h, const T& t) :
explicit cons(const head_type& h, const T& t) :
head(h), tail(t.head, t.tail)
{
}
explicit cons(head_cref h = head_type(),
tail_cref t = tail_type()) :
explicit cons(const head_type& h = head_type(),
const tail_type& t = tail_type()) :
head(h), tail(t)
{
}
@ -423,31 +416,20 @@ 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(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()
) :
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()) :
cons1(t1, cons2(t2, cons3(t3, cons4(t4, cons5(t5, cons6(t6,cons7(t7,cons8(t8,cons9(t9,cons10(t10))))))))))
{
}
@ -666,8 +648,8 @@ namespace tuples {
detail::assign_to_pointee<T2>(&t2),
detail::assign_to_pointee<T3>(&t3),
detail::assign_to_pointee<T4>(&t4),
detail::assign_to_pointee<T5>(&t5),
detail::assign_to_pointee<T6>(&t6));
detail::assign_to_pointee<T6>(&t5),
detail::assign_to_pointee<T5>(&t6));
}
// Tie variables into a tuple

View File

@ -18,13 +18,6 @@
#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

@ -69,7 +69,7 @@ inline bool neq(const T1& lhs, const T2& rhs) {
neq(lhs.get_tail(), rhs.get_tail());
}
template<>
inline bool neq<null_type,null_type>(const null_type&, const null_type&) { return false; }
inline bool neq<null_type,null_type>(const null_type&, const null_type&) { return true; }
template<class T1, class T2>
inline bool lt(const T1& lhs, const T2& rhs) {

View File

@ -36,23 +36,6 @@
#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 {
@ -345,11 +328,7 @@ extract_and_check_delimiter(
{
const char d = format_info::get_manipulator(is, del);
#if defined (BOOST_NO_STD_LOCALE)
const bool is_delimiter = !isspace(d);
#else
const bool is_delimiter = (!std::isspace(d, is.getloc()) );
#endif
const bool is_delimiter = (!isspace(d) );
char c;
if (is_delimiter) {
@ -436,11 +415,7 @@ extract_and_check_delimiter(
{
const CharType d = format_info::get_manipulator(is, del);
#if defined (BOOST_NO_STD_LOCALE)
const bool is_delimiter = !isspace(d);
#else
const bool is_delimiter = (!std::isspace(d, is.getloc()) );
#endif
const bool is_delimiter = (!isspace(d) );
CharType c;
if (is_delimiter) {

View File

@ -1,8 +0,0 @@
<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>

View File

@ -1,20 +0,0 @@
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,10 +119,9 @@ 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,6 +19,8 @@
#include <sstream>
#endif
#include "boost/config.hpp"
using namespace std;
using namespace boost;
@ -31,8 +33,7 @@ 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;
@ -93,7 +94,7 @@ int test_main(int argc, char * argv[] ) {
useThisIStringStream is("(100 200 300)");
tuple<int, int, int> ti;
BOOST_TEST(bool(is >> ti));
BOOST_TEST(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 = A(); B b;
A a; B b;
const A ca = a;
make_tuple(cref(a), b);
make_tuple(ref(a), b);
@ -395,7 +395,6 @@ equality_test()
tuple<int, char> t4(2, 'a');
BOOST_TEST(t1 != t3);
BOOST_TEST(t1 != t4);
BOOST_TEST(!(t1 != t2));
}