Re: [pygccxml-development] type_traits problem
Brought to you by:
mbaas,
roman_yakovenko
From: Allen B. <al...@vr...> - 2006-05-12 12:38:57
|
I have attached a patch that adds a test case. I think all the is_* tests suffer from a similar problem. They only seem to examine the "outside" most type information and ignore the internal data. For example, shouldn't is_float return true for a "const float" type? -Allen Roman Yakovenko wrote: > On 5/12/06, Allen Bierbaum <al...@vr...> wrote: > >> I just ran into an annoyance that I had seen before bug forgot to post. >> >> I am checking a return_type from a method to see if it is a const >> reference and the type traits are not working well. >> >> The problem is that is_const and is_reference only check the most >> external portion of a composed type. So if you want to check if >> something is really a const ref you have do write code something like >> this (please correct me if I am wrong). >> >> ret_type = method.return_type >> is_ref = True in map(declarations.is_reference, >> declarations.decompose_type(ret_type)) >> is_const = True in map(declarations.is_const, >> declarations.decompose_type(ret_type)) >> is_const_ref = (is_ref and not is_const) >> >> Boost type traits and other libraries like it automatically do the >> decomposition so you could check a const reference type and it will >> return true to both is_reference and is_const. >> >> Is there any reason that we shouldn't make pygccxml work similarly? > > > Yes. I did not have test case for this. If you can send me test case I > will make > sure it works as expected. > >> -Allen >> >> >> ------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, >> security? >> Get stuff done quickly with pre-integrated technology to make your >> job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> pygccxml-development mailing list >> pyg...@li... >> https://lists.sourceforge.net/lists/listinfo/pygccxml-development >> > > |