[C++-sig] Split_module and file names

Nicolas Tessore Tessore at stud.uni-heidelberg.de
Tue Nov 21 00:16:33 CET 2006


Roman Yakovenko, 20.11.2006 19:56
> I could be wrong, but std uses "containers" terminology. .NET for example uses
> "collection" word. So, I thought it should be clear what I mean. It
> has nothing to
> do with templates.
> 

Of course, you are right. I just failed to realize the above.

Anyway, there is still a problem with the new approach: I extended it to 
all templates, and failed, somehow, neither the container approach nor 
the templates.is_instantiation method seems to be able to catch the 
map<T> type (and list<T> as well, I think):

------------------------------------------------------------------------

# Function to rename the STL containers
def rename_containers( cls ):
     class_trait = None

     // check there are really some map containers
     if cls.name.startswith("map"):
         print cls.name

     for ct in declarations.all_container_traits:
         if ct.is_my_case( cls ):
             class_trait = ct

     if not (class_trait or 
declarations.templates.is_instantiation(cls.decl_string)):
         return

     // no map container ever makes it here - vector does!
     print cls.name
     cls.rename(TemplateAlias(cls.decl_string))

...

# Rename the container types
classes = mb.classes()
map( rename_containers, classes )

------------------------------------------------------------------------

 From what I understand, the
     declarations.templates.is_instantiation(cls.decl_string)
line alone should be able to catch whatever template type I run into.

What am I missing this time?

N.



More information about the Cplusplus-sig mailing list