|
Boost : |
From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2006-05-18 07:03:44
"Asger Mangaard" <tmb_at_[hidden]> writes:
> David Gruener wrote:
>>>>I'm not sure what this utility is trying to address.
>>>>The motivation is not to write down constructor, destructor, assignment
>>>>operator
>>>>and so on. But, unfortunately, you have to.
>>>
>>> Why do you think that? No, you don't have to write a constructor,
>>
>> You have to, and you should read the pointers you are given.
>> (here: The article with the grin pointer.)
>>
>>> Still I don't agree with you. Do you have an example to showcase this?
>>
>> Simple. Just try to use (create, detroy, copy...) a pimpled class
>> with implicit defined functions somewhere else than in the implementation
>> file.
>
> Could you please provide an example? I don't see your point when I'm
> providing code and examples that does what you claim it can't.
>
> Maybe I'm missing something?
>
> Could I add; I'm not in any way trying to be rude, I'm just trying to
> understand your points.
//test.hpp
#include "boost/pimpl_ptr.hpp"
class test
{
public:
void do_stuff();
private:
boost::pimpl_ptr<struct test_implementation> pimpl;
};
//test_impl.cpp
#include "test.hpp"
struct test_implementation
{
void really_do_stuff(){}
};
void test::do_stuff()
{
pimpl->really_do_stuff();
}
//test_usage.cpp
#include "test.hpp"
int main()
{
test x; // Error, test_implementation incomplete.
x.do_stuff();
}
Anthony
-- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk