jeudi 15 octobre 2020

Hidden friend functions

I'm making a library, and I want one of the functions to be hidden from the library as I have provided a user-friendly wrapper for it, so I used a versioning script. All is well, until I realised that the hidden function uses private members of a class. But I couldn't make it a friend because it is hidden. What do I do?

EDIT

Minimal reproducible example:

// hidden-friend.hxx
class some_class
{
        int x;
};
void edit_x(int, someclass&);


// hidden_friend.cxx
#include <hidden-friend.hxx>

void hidden_edit_x(int x, some_class& obj)
{
        obj.x = x;
//      ...
}

void edit_x(int x, some_class& obj)
{
        hidden_edit_x(x, obj);
}

Aucun commentaire:

Enregistrer un commentaire