So basically this is what I want to make:
void someMethod() {
StreamClass streamClass{};
streamClass << "Something" << "\n"; //do something
streamClass.doA << "Something" << "\n"; //do another thing
streamClass.doB << "Something" << "\n"; //do something else
//If the first one is impossible, what about this?
streamClass << "Something" << "\n"; //do something
streamClass::doA << "Something" << "\n"; //do another thing
streamClass::doB << "Something" << "\n"; //do something else
//Or this?
streamClass<enumA> << "Something" << "\n"; //do something
streamClass<enumB> << "Something" << "\n"; //do another thing
streamClass<enumC> << "Something" << "\n"; //do something else
}
Header file:
class StreamClass {
public:
StreamClass(); //Init class
//... and many other things
template<typename T>
StreamClass& operator<<(T t) {
//... do something that uses data and t
}
//And do something here?
protected:
Data data; //some data owned by this object
};
So, is there anyway to do something like that? And how to do it in the fastest way?