Hi everyone,
After a period of time of developing with URE, I find the C++ UNO
class Reference is not very comfortable for use sometime.
The problem is, when I have a reference of base interface XA and a
reference of derived interface XB, I can't make xA = xB directly.
Instead I have to query XA from xB like this xA = Reference<XA>::query(xB).

I wonder that whether we can use template constructors to simply this
situation.These constructors may something like this:

template <typename interface_type>
class Reference
{
    template <_interface_type>
    Reference(const Reference<_interface_type>& rRef)
    {
        interface_type* p = NULL;
        _interface_type* _p = NULL;
        p = _p; // compiling time cast check.
        _pInterface = iquery( rRef.get() );
    }

    // copy constructor
    Reference(const Reference<_T>& another)
    {
        ...
    }
}

Now we can simplify the cast code above to
xA = xB;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@udk.openoffice.org
For additional commands, e-mail: dev-h...@udk.openoffice.org

Reply via email to