Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

DPtr Magic #74

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open

DPtr Magic #74

wants to merge 2 commits into from

Conversation

scunz
Copy link
Member

@scunz scunz commented Mar 29, 2015

@antis81

This began as playing around with the D-Pointers for RepoMan. What I wanted to achieve is to get a solution to have concretely casted D-Pointers without the usage of the preprocessor macros. This is more or less what I ended up with.

Turned out, that esp. in libGitWrap, we have to do the required D-Ptr test quite often even though we might have actually concluded that it is redundant. However, with this approach we can optimise the code flow for the most likely path. i.e.:

QStringList X::getSomeData(Result& res) const {
    QStringList sl;
    ConstDPtr d(this, result);
    if (d) {
        git_strarray a;
        result = git_get_some_data(d->mRepo, &a);
        if (result) {
            QStringList sl = wrapIt(a);
            git_strarray_free(&a);
            return sl;
        }
    }
    return QStringList();
}

@antis81
Copy link
Member

antis81 commented May 19, 2015

@scunz I'd like to bring this in after the "Service" thing is done. Is that 🆗?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants