Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2002-01-11 07:15:44


Jaakko, Dave,

I've traced the problems with tuple and the Borland compiler to a single
statement: it's the:

using tuples::get;

In tuple.hpp.

I tried replacing this with a forwarding function:

#ifndef __BORLANDC__
using tuples::get;
#else
template<int N, class HT, class TT>
inline typename tuples::access_traits<
                  typename tuples::element<N, tuples::cons<HT, TT> >::type
>::non_const_type
get(tuples::cons<HT, TT>& c) {
  return tuples::get<N,HT,TT>(c);
}
// get function for const cons-lists, returns a const reference to
// the element. If the element is a reference, returns the reference
// as such (that is, can return a non-const reference)
template<int N, class HT, class TT>
inline typename tuples::access_traits<
                  typename tuples::element<N, tuples::cons<HT, TT> >::type
>::const_type
get(const tuples::cons<HT, TT>& c) {
  return tuples::get<N,HT,TT>(c);
}
#endif

and then replaced all occurances of "tuples::get" with "get" in the test
program - everything checks out fine now with Borland, and the problems
with tie_example.cpp and counting_iterator_test.cpp also go away. I wonder
if this forwarding function can also fix the problems that VC6 has with the
"using tuples::get" statement - it's signature would need changing, but
that's not a big issue is it?

Thoughts?

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk