Skip to content

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