Preliminary wording of the smart pointer class

I have a header file:

class A
{
public:
    DeviceProxyPtr GetDeviceProxy(); 
};

DeviceProxyPtr is defined in another header file as follows:

typedef SmartPtrC<DeviceProxyC> DeviceProxyPtr;

I do not want to include the title of the DeviceProxyPtr definition. If the return type was DeviceProxy *, I could just use a preliminary declaration class DeviceProxy. Is there a way to do the same with my smart pointer class?

+3
source share
1 answer

The fact that this is a specific return type does not matter. You can forward the return type declaration.

However, in this case it is not a class, but a typedef. You could not use class DeviceProxy, even if it was a pointer.

, . , . iostream ​​ . , istream , typedef basic_istream. , <iosfwd>, - basic_istream, istream typedef. , , iostream, #include <iosfwd> , #include <iostream> .

+2

Source: https://habr.com/ru/post/1744900/


All Articles