Boost logo

Boost Users :

Subject: [Boost-users] tuple
From: luca formaggia (luca.formaggia_at_[hidden])
Date: 2010-04-22 17:01:24


Hello,

someone could tell me what is wrong in this piece of code

#include "boost/tuple/tuple.hpp"
using namespace boost::tuples;
int main(){
        tuple<int, double> t2();
        get<0>(t2)=int(10);
}

I get the following error message:

g++ try.cpp
try.cpp: In function ‘int main()’:
try.cpp:5: error: no matching function for call to
‘get(boost::tuples::tuple<int, double, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type, boost::tuples::null_type,
boost::tuples::null_type> (&)())

In the tutorial it is written that tuple<int, double> t2() should construct
the object via the default constructor. Why I cannot access the first
element (it works if I give an initial value, for instance using tuple<int,
double> t2(1); I get a similar error if I use the method get<N>() instead
of the function.

I am using gnu compiler gcc version 4.4.1 (GCC) in a i386 linux machine.

Thank you,

Luca

-- 
Luca Formaggia


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net