Dear friends,
Please look my code and when I trying to print the values of structure "status_rsp" using insertion operator overloading but it is giving "error as " no match operator << .
how to print value by using insertion operator overloading , because here ie in this sample code without overloading also printing but this is the piece of or sample of code , so once I executed there it is giving error as " no match operator for <<..
please any one tell me how to get out of this problem.
code:
#include<vector>
#include<iostream>
using namespace std;
The problem is os << "the value is " << sr.rsp.ll.begin();
I'm not sure what you're trying to do. begin() returns an iterator which cannot be printed. Maybe you wanted ...front().value instead?
Dear friend , thanks for your kind help , so it is working fine.
the actual code look like bellow code. so when i try to run the following code it is giving the big error message regrading boost variant please any one could help me to get out of this problem.
just what i want is assign a values to structure status_rsp made up other structure which intern contain multiple vectors. pls see my code..
#include<vector>
#include<iostream>
#include<boost/variant.hpp>
typedef int channelid;
typedef int num_queue;
typedef boost::variant<channelid> link_st_rs;
typedef std::vector<link_st_rs> link_st_rs_list;
typedef boost::variant<num_queue> link_de_rs;
typedef std::vector<link_de_rs> link_de_rs_list;
using namespace std;
error I am getting is :
std::ostream& operator<<(std::ostream&, const status_rsp&)’:
worked.cpp:33: error: ‘const struct status_rsp’ has no member named ‘os’
worked.cpp:33: error: ‘const class boost::variant<int, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>’ has no member named ‘channelid’
worked.cpp:33: error: expected ‘)’ before ‘;’ token
worked.cpp:34: error: ‘const class boost::variant<int, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost