[aspectc-user] advice not working with std::string default argument

Mike Mortensen mike-mortensen at comcast.net
Mon Mar 12 02:12:03 CET 2007


Have you tried using   --real_instances  when weaving?
The string class is templatized (with how it uses basic_char, etc.), and so
having string arguments may require --real_instances?
-Mike

----- Original Message ----- 
From: "Timothy Stack" <stack at cs.utah.edu>
To: <aspectc-user at aspectc.org>
Sent: Sunday, March 11, 2007 5:42 PM
Subject: [aspectc-user] advice not working with std::string default argument


>
> Hi,
>
> I seem to be having trouble getting an advice to apply to a method  with a 
> string default argument.  If I change the argument to an  integer with a 
> default value, it works, but no joy the other way.   Here's an example:
>
> actest.cc:
>   #include <stdio.h>
>
>   #include <string>
>
>   class actest {
>   public:
>
>       unsigned int mymethod(const std::string msg = "")
>       {
>   return printf("%s\n", msg.c_str());
>       };
>   };
>
>   class accaller {
>   public:
>       void foo() {
>   actest ac;
>
>   ac.mymethod();
>       };
>   };
>
> actest.ah:
>   #include <stdio.h>
>
>   aspect AcDefTest {
>       advice call("% actest::mymethod(...)") && within("accaller") : 
> before() {
>   printf("Hello, World!\n");
>       };
>   };
>
> Looking at the generated .acc file, the 'ac.mymethod()' call wasn't 
> transformed like I had expected.
>
> thanks,
>
> tim stack
>
> _______________________________________________
> 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