You need to overload operator <<
for mystruct
class
Something like :-
friend ostream& operator << (ostream& os, const mystruct& m)
{
os << m.m_a <<" " << m.m_b << endl;
return os ;
}
See here
More Related Contents:
- Using paragraphs 8.5.3p4 and p5 in the C++11 Standard, how do I prove that the snippet below doesn’t compile?
- Rvalue Reference is Treated as an Lvalue?
- How do I terminate a thread in C++11?
- When should std::move be used on a function return value? [duplicate]
- Why does this C++ snippet compile (non-void function does not return a value) [duplicate]
- What is the type of lambda when deduced with “auto” in C++11?
- How to specialize std::hash::operator() for user-defined type in unordered containers?
- How to initialize std::array elegantly if T is not default constructible?
- Why does auto x{3} deduce an initializer_list?
- How much is the overhead of smart pointers compared to normal pointers in C++?
- How do I initialize a member array with an initializer_list?
- Template tuple – calling a function on each element
- Does moving a vector invalidate iterators?
- How to use std::async on a member function?
- what is the difference between set and unordered_set in C++?
- Overloaded lambdas in C++ and differences between clang and gcc
- Is it legal to declare a constexpr initializer_list object?
- C++ parameter pack, constrained to have instances of a single type?
- C++11 way to index tuple at runtime without using switch
- Initializing container of unique_ptrs from initializer list fails with GCC 4.7
- Why do you use std::move when you have && in C++11? [duplicate]
- What happens when you call data() on a std::vector?
- Should a move constructor take a const or non-const rvalue reference?
- how to avoid undefined execution order for the constructors when using std::make_tuple
- What is the class keyword before a function argument?
- Move out element of std priority_queue in C++11
- When must you pass io_context to boost::asio::spawn? (C++)
- What is the purpose of std::function and how to use it?
- const auto std::initializer_list difference between Clang and GCC
- Workaround for error C2536: cannot specify explicit initializer for arrays in Visual Studio 2013