mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
I think this is the proper way doing PIMPL
This commit is contained in:
parent
6e75be33ec
commit
066e6a6969
@ -42,6 +42,8 @@ ScalarRenderer::ScalarRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
ScalarRenderer::ScalarRenderer(ScalarRenderer&&) noexcept = default;
|
||||
ScalarRenderer& ScalarRenderer::operator=(ScalarRenderer&&) noexcept = default;
|
||||
ScalarRenderer::~ScalarRenderer() = default;
|
||||
|
||||
void ScalarRenderer::SetWidth(const vtkm::Int32 width)
|
||||
|
@ -25,11 +25,18 @@ class VTKM_RENDERING_EXPORT ScalarRenderer
|
||||
public:
|
||||
ScalarRenderer();
|
||||
|
||||
// Note: since we are using std::unique_ptr<T> for PIMPL, the compiler does
|
||||
// not know the real size of std::unique_ptr<T> at this point. Thus, we
|
||||
// can not have the definition of the destructor here. We need to declare it
|
||||
// here and have an implementation in .cxx. The implementation could just
|
||||
// be = default.
|
||||
// Disable copying due to unique_ptr;
|
||||
ScalarRenderer(const ScalarRenderer&) = delete;
|
||||
ScalarRenderer& operator=(const ScalarRenderer&) = delete;
|
||||
|
||||
// Note: we are using std::unique_ptr<SomeIncompleteType> with default deleter for PIMPL,
|
||||
// the compiler does not know how to delete SomeIncompleteType* at this point. Thus, we
|
||||
// can not omit the declaration of destructor, move assignment operator and let the
|
||||
// compiler generate implicit default version (which it can't.) We also can not have
|
||||
// inline definitions of them here. We need to declare them here and have definitions in
|
||||
// .cxx where SomeIncompleteType becomes complete. The implementations could just be = default.
|
||||
ScalarRenderer(ScalarRenderer&&) noexcept;
|
||||
ScalarRenderer& operator=(ScalarRenderer&&) noexcept;
|
||||
~ScalarRenderer();
|
||||
|
||||
void SetInput(vtkm::cont::DataSet& dataSet);
|
||||
|
Loading…
Reference in New Issue
Block a user