OMNI_OSTREAM_OPERATOR
MACRO

OMNI_OSTREAM_OPERATOR - A helper macro to implement the operator<< stream friend function

SYNOPSIS top

This macro can be utilized to implement the friend std::ostream& operator<< function in a class.

DESCRIPTION top

This is a helper macro that can allow you to implement the friend std::ostream& operator<< function within a class to allow to print to an output stream.

Example:
#include <omni/framework>
class MyClass
{
    public:
        MyClass() : m_val(42) {}
        OMNI_OSTREAM_OPERATOR(MyClass, m_val)
    private:
        int m_val;
};

int main(int argc, char* argv[])
{
    MyClass val;
    std::stringstream ss;
    ss << val;
    std::cout << "string stream, val = " << ss.str() << std::endl;
    std::cout << "ostream operator, val = " << val << std::endl;
    return 0;
}

CONSIDERATIONS top

No special considerations

PLATFORM SPECIFIC top

No platform specific notes.

NOTES top

None.