|
Boost : |
From: Carlo Wood (carlo_at_[hidden])
Date: 2006-05-18 10:21:38
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_at_[hidden]>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk