-
June 13th, 2011, 05:13 PM
#1
template and boost::tuples
The code is as follows:
#include "boost/tuple/tuple.hpp"
template< typename iter1_T = boost::tuples::null_type,
typename iter2_T = boost::tuples::null_type,
typename iter3_T = boost::tuples::null_type,
typename iter4_T = boost::tuples::null_type,
typename iter5_T = boost::tuples::null_type,
typename iter6_T = boost::tuples::null_type,
typename iter7_T = boost::tuples::null_type,
typename iter8_T = boost::tuples::null_type,
typename iter9_T = boost::tuples::null_type,
typename iter10_T = boost::tuples::null_type
>
struct tuples_N {
typedef boost::tuple<iter1_T&, iter2_T&, iter3_T&, iter4_T&, iter5_T&, iter6_T&, iter7_T&, iter8_T&, iter9_T&, iter10_T&> tuple_N;
};
int main() {
int *x;
int *y;
int *z;
tuples_N<int*,int*,int*>::tuple_N *pp = new tuples_N<int*,int*, int*>::tuple_N(x,y,z);
}
Got a compilation warning, though the compilation went thru. The warning is rather long.
You will see it if you compile it with g++:
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)
In essence, the warning is about
/usr/include/boost/tuple/detail/tuple_basic.hpp:447: warning: default-initialization of 'boost::tuples::null_type& boost::tuples::cons<boost::tuples::null_type&, boost::tuples::null_type>::head', which has reference type
I'm wondering if there's a way to get rid of the warning by changing the code in main() as
I can't change the struct. I understand that if I change iter1_T& to iter1_T in the struct, then the warning goes away.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|