C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with compilation of very short program using boost::tup

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Frank Astier
Guest





PostPosted: Sat Nov 27, 2004 12:33 pm    Post subject: Help with compilation of very short program using boost::tup Reply with quote



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





PostPosted: Sat Nov 27, 2004 9:27 pm    Post subject: Re: Help with compilation of very short program using boost: Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.