Changing a pointer type to my defined type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iammilind
    New Member
    • Sep 2006
    • 14

    Changing a pointer type to my defined type

    Is there any way to change a pointer type to our user defined type.
    For example,
    In my code, I have something like this:
    =============== =============== ===
    int i = 0;
    int *p;
    int **pp;
    =============== =============== ===

    I want it to be,

    =============== =============== ===
    int i = 0;
    MyType<int> p;
    MyType<MyType<i nt> > pp;
    =============== =============== ===

    I tried to write a manual parser for this; however, there were so many corner cases coming out.
    I think there is no language facility; but is there any way to change the pointer type at compilation or any other level ?

    Assume that, I want it do be done in existing code.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    If you are talking about re-factoring across an existing source code base

    T * to MyType<T>

    Then I thing you have a hard time ahead of you. There are re-factoring tools, for instance Eclipse contains a re-factoring tool that allows you to rename a variable or type across a code base. Whether it would be able to cope with anything so complex is beyond my guess. I imagine you can also by re-factoring tools,I also imagine they are expensive.

    Comment

    Working...