
On Thu, May 18, 2006 at 01:06:46PM +0200, Pavel Vozenilek wrote:
"Asger Mangaard" wrote:
Why do you think that? No, you don't have to write a constructor, destructor, or an assigment operator for the pimpl_ptr to work. Please look at the example/default.cpp file.
Create additional *.cpp file, include the "pimpl_ptr.hpp" and try to use it. Compiler error follows.
That shouldn't be the case if pimpl_ptr never tries to construct the templated type in it's header. Which compiler/version is everyone using? Maybe one or the other is broken. This should compile fine: ---------- template<typename T> struct pimpl_ptr { T* ptr; // Only pointers allowed. }; struct test_impl; struct test { pimpl_ptr<test_impl> ptr; }; int main() { test t; // OK } ------------ While this should indeed give an error: ------------ template<typename T> struct pimpl_ptr { T ptr; // Actually constructing type T. }; struct test_impl; struct test { pimpl_ptr<test_impl> ptr; }; int main() { test t; // Error, 'test_impl' incomplete } ------------ -- Carlo Wood <carlo@alinoe.com>