[antlr-interest] Re: Cloning

antlrlist antlrlist at yahoo.com
Fri Jun 20 07:08:43 PDT 2003


> The following is a code fragment in my "clone" method for my custom
C++ AST node:
>  
>     /* CustomNodeType *ast = new CustomNodeType(*this); */
>     std::cout << "      Clone created at " << ast << "(this=" <<
this << ")" << std::endl;
>     antlr::RefAST ret(ast);
>     std::cout << "      Clone ref.get() (after assignment): " <<
ret.get() << std::endl;
 
>       Clone created at 0xa0459c8(this=0xa0450d0)
>       Clone ref.get() (after assignment): 0xa0450d0
>  

Does it do the same if you use "new"? I mean like this:

antlr::RefAST ret = new antlr::RefAST(ast);

Cheers,

Enrique


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list