Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-04-11 16:51:16


On Wednesday 11 April 2001 02:55, you wrote:
> There's a problem with tuple (from the vault) on MSVC SP5.
>
> The following program demonstrates the problem:
>
> #include <iostream>
> #include <boost/tuple.hpp>
>
> int main() {
> boost::tuple<int, int, int> t = boost::tuple<3, 9, 27>;
>
> std::cout << "1: " << boost::get<1>(a) << std::endl;; // output's 27!
> // likewise for get<2> and get<3> all output 27
>
> return 0;
> }
>
> I don't see that the tuple library is at fault though. It appears to
> be an MSVC problem as the instantiation of:
>
> template<int N, typename Tuple>
> typename tuple_element_type_ref<N, Tuple>::RET
> get(Tuple & t) {
> int n = N; // added for debugging: n == 3!
> return tuple_element<N>::get(t);
> }
>
> Is instantiated with N == 3 even though explicitly provided at call as 1.
>
> Although I was under the impression that this specific version of tuple
> was supposed to work with VC (n.b. this instance is not tested for in
> tuple_test.cpp).
>
> - Dale.

I was not able to reproduce this problem using VC6 SP5. I'm assuming the
exact testcase is:

#include <iostream>
#include <boost/tuple.hpp>

int main() {
        boost::tuple<int, int, int> t = boost::tuple<int, int, int>(3, 9, 27);
 
        std::cout << "1: " << boost::get<1>(t) << std::endl;; // output's 27!
  // likewise for get<2> and get<3> all output 27
 
  return 0;
}

Any other information you could give us would be helpful.

        Doug


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