 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Frank Astier Guest
|
Posted: Sat Nov 27, 2004 12:33 pm Post subject: Help with compilation of very short program using boost::tup |
|
|
The following small program doesn't compile. I am guessing that this has
something to do with the fact that it doesn't know how to do istream& >>
vector<float>, but I thought I had been careful to tell him how to do that...
What am I missing?
Thanks!
Frank
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <iostream>
#include <vector>
template <typename T>
std::istream& operator>>(std::istream& in, std::vector<T>& v)
{ /* appropriate code */ return in; }
struct A : public boost::tuple<std::vector
{
A(std::istream& in) { in >> *this; }
};
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Frank Astier Guest
|
Posted: Sat Nov 27, 2004 9:27 pm Post subject: Re: Help with compilation of very short program using boost: |
|
|
Actually, this simpler program has the same compile time error+
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <iostream>
#include <vector>
template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector
{ return out; }
int main(int, char**)
{
std::vector<int> v;
std::cout << v;
boost::tuple t;
std::cout << t;
}
The error reads:
Compiling with Intel(R) C++ 8.1 ...(Intel C++ Environment)
TestTuples.cpp
C:boost_1_32_0boost/tuple/tuple_io.hpp(255): error: no operator "<<"
matches these operands
operand types are: std::basic_ostream
std::char_traits << const boost::tuples::cons
std::allocator,
boost::tuples::detail::map_tuple_to_cons<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, boost::tuples::null_type,
boost::tuples::null_type>::type>::stored_head_type
return o << t.head;
^
detected during:
instantiation of "std::basic_ostream<_Elem, _Traits>
&boost::tuples::detail::print(std::basic_ostream<_Elem, _Traits> &,
const boost::tuples::cons<T1, boost::tuples::null_type> &) [with
CharType=char, CharTrait=std::char_traits<char>, T1=std::vector<float,
std::allocator]" at line 321
instantiation of "std::basic_ostream<_Elem, _Traits>
&boost::tuples::operator<<(std::basic_ostream<_Elem, _Traits> &, const
boost::tuples::cons<T1, T2> &) [with CharType=char,
CharTrait=std::char_traits<char>, T1=std::vector<float,
std::allocator,
T2=boost::tuples::detail::map_tuple_to_cons<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,
boost::tuples::null_type, boost::tuples::null_type>::type]"
compilation aborted for .TestTuples.cpp (code 2)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|