Dllexport with nested classes

In the DLL I'm working on, I have the following class that I would like to export:

class A {

public:
    class B
    {
        std:string placeholder;
    };

    boost::shared_ptr<B> sp;
};

With this code I need dllexport A, A::Band boost::shared_ptr<A::B>. I cannot dllexport boost::shared_ptr<A::B>(what should I do at the namespace level) before the declaration A::sp, because it class A::Bis not yet known. Declaring it like this:

class A::B;

does not work. Declaring it like this:

class B;

actually declares another class. How can I solve it?

+4
source share

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


All Articles