Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically instantiate aliased container templates #108

Merged
merged 2 commits into from
Nov 14, 2020

Conversation

HertzDevil
Copy link
Contributor

This PR adds support for two kinds of aliases:

  • Aliased names inside template type arguments, e.g. QVector<QRgb> now resolves properly to QVector<unsigned int>. Both C++ types will use the same wrapper, so the former container is no longer instantiated separately, as required by Generic pseudo-instantiation macro for container wrapper types #102.
  • Aliases to container instantiations, e.g. QObjectList now resolves properly to QList<QObject *>. Consequently, the wrapper for QObject::children() will no longer return a raw pointer to the container after this PR, as long as the appropriate alias is defined in the config file:
    types:
      QObjectList: { alias_for: "QList<QObject *>" }

Due to recent changes, the type database now has separate rule entries for actual C++ containers (e.g. QList<QWindow *>) and their template-less aliases (e.g. Container_QList_QWindow_X_). This shouldn't affect any existing bindings; in particular, typedefs in the C++ wrappers are unaffected because they are populated by Graph::Alias instead.

@Papierkorb Papierkorb merged commit 6b94540 into Papierkorb:master Nov 14, 2020
@Papierkorb
Copy link
Owner

Thanks!

@HertzDevil HertzDevil deleted the aliased-templates branch November 14, 2020 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants