Martin Vermeer wrote:

> On Mon, Aug 04, 2003 at 05:08:55PM +0100, Angus Leeming spake thusly:
>> 
>> Martin Vermeer wrote:
>> > Perhaps I'd better have a closer look at LColor.[Ch]...
>> > Attached a first attempt for comment...  as you see, I'm struggling.
>> 
>> Well, the header file looks pretty reasonable, although you should
>> aim to use
>>         boost::scoped_ptr<Impl> pimpl_;
>> to store the implementation eventually.
>> 
>> (Incidentally, the idiom here is Pointer to Implementation. I have no
> 
> or "Private Implementation" according to lit.
> 
>> idea why we call the class Pimpl in LyX. To my mind Impl makes far
>> more sense...)
>> 
>> As for the .C file:
>> 
>>         void fill(ColorEntry const & entry) {
>>                 ...
>> -               int & no = transform[entry.lyxname];
>> -               no = entry.lcolor;
>> +               transform[entry.lyxname] = int(entry.lcolor);
>>         }
>> 
>> The two LColor::getGUIName functions look pretty much how I imagined
>> them to be.
>> 
>> Where exactly are you struggling?
> 
> For example... why doesn't delete pimpl_ work if it's a scoped
> pointer? Is it needed at all? Is this one of the ideas with these
> smart pointers?

If you use a boost::scoped_ptr you don't need to define a destructor at all. 
The scoped_ptr will take care of the destruction.

> LColor.C: In method `LColor::~LColor()':
> LColor.C:157: type `class boost::scoped_ptr<LColor::Pimpl>' argument
> given to `delete', expected pointer
> ...etc...



-- 
Angus

Reply via email to