std::ostream & _return = ::operator<<(_os, _event)
Especially I would like to know: What is the data type of _return and How can I print it in console.
std::ostream & _return = ::operator<<(_os, _event)
Especially I would like to know: What is the data type of _return and How can I print it in console.
std::ostream & _return = ::operator<<(_os, _event);
Especially I would like to know: What is the data type of _return and How can I print it in console.
The code looks for an operator<< at global scope (not in any namespace), which can accept the _os and _event objects as parameters. It's not necessarily true, but given "<<" is the normal way streaming output is done in C++, you can expect that it's probably going to be a function such as:
std::ostream& operator<<(std::ostream&, const Event&);
Where Event is whatever type the _event object has, and I've assumed _os will be some type derived from std::ostream, and consequently able to be handled by a reference to std::ostream.
Almost all such operator<< functions return their first stream argument, so your code is probably doing some output, then effectively assigning to _return as if it were:
std::ostream& _return = _os;
Here, the static type of _return itself is std::ostream& - a reference to a std::ostream (Standard output stream) object, but the run-time type will be whatever type _os has... that's the type of object that operations on _return will invoke polymorphically. This could be ofstream, ostringstream or many other types.
How can I print it in console.
There is no Standard way to get textual type names in C++, though runtime polymorphic types do have runtime type information that includes an optional textual field that's normally populated with a type name of some sort - whether it will have full namespace qualifiers, name mangling or whatever is unspecified, but you can try it easily enough:
std::cout << typeid(_return).name() << '\n';
(For GCC, see Unmangling the result of std::type_info::name for tips on unmangling such type names)
_return is just a variable of type "Reference to std::ostream class object".
And it is initialized with a return value of << operator in global namespace ::operator<<(ostream& os, const some_Obj_reference& ref).
Ttis could be as well
std::ostream & _return = (_os <<_event);