Rather than adding a SliderAttachment member to each Slider, why don’t you keep around this kind of struct for whenever you need such a coupling:
struct SliderWithAttachment
{
ScopedPointer <Slider> slider;
ScopedPointer <SliderAttachment> attachment;
};
This way, in your Editor you can simply add a member like:
SliderWithAttachment knob;
and voila, you have the knob.slider and the knob.attachment automatically deleted in the correct order, and also nicely bound together making the code more readable IMHO
