[aspectc-user] introduce members between existing members

Olaf Spinczyk os at aspectc.org
Thu May 7 19:00:33 CEST 2009


Hi Steven,

there is no way to do this in AspectC++. Why do you want to do that?

The only language feature that might help you here is the advice 
ordering mechanism: If two new members are introduced by different 
aspects, the ordering mechanism can define the order in which the new 
elements are introduced. I know that this is not what you want, but 
maybe you could use it as a workaround.

If you explicitly want to mark the point of introduction in your target 
class, you could also define an inner class MyClass::Inner, which is 
empty, and declare an instance of this class at your insertion point. 
The advice could then use the type MyClass::Inner for the introduction. 
This probably comes close to what you want with respect to binary object 
layout.

Cheers,

Olaf

steven wrote:
> hi,
>
> I have to introduce a new member between existing members; not just
> append the new member:
>
> class MyClass{
>
>     private:
>     int one;
>     //insert new member here
>     int two;
> }
>
> how can this be expressed .. how can a sliced be introduced at
> certain positions?
>
> advice "MyClass": slice class{
>     int between_one_and_two;
> }
>
>
> regards,
>
> steven
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
>




More information about the aspectc-user mailing list