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

Add forward declarations and typedefs for exposed structures #192

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

davebayer
Copy link

@davebayer davebayer commented Oct 17, 2024

This PR introduces vkFFT-fwd.h module that includes forward declarations and typedef of user exposed structures. The goal is to reduce the compilation times when including VkFFT in a header file. It does not contain any backend dependent code, thus is independent on the selected backend completely.

After this change, this behaviour is possible:

// Class.hpp
#include <memory>
#include <vkFFT-fwd.h>

class Class
{
public:
  // ...
private:
  struct VkFFTApplicationDeleter;

  // This works
  VkFFTApplication* mAppPtr{};

  // This also works
  std::unique_ptr<VkFFTApplication, VkFFTApplicationDeleter> mAppUniquePtr{};

  // Fails to compile as it would require require the backend dependent VkFFTApplication struct definition
  // VkFFTApplication mApp{};
};
// Class.cpp
#define VKFFT_BACKEND 1
#include <vkFFT.h>

struct Class::VkFFTApplicationDeleter
{
  void operator()(VkFFTApplication* app)
  {
    deleteVkFFT(app);
  }
};

// ...

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.

1 participant