Hi,
How to implement the operator << for C++??
I need to use it like that:
cout<<(*iter)
iter is an iterator is pointing to a vector of some type I've defined.
Thank you!!
You define operator<<
for your class. For example:
struct Foo {
friend std::ostream& operator<< (std::ostream& os, const Foo& f);
};
Then define that function as you would like.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.