[pygccxml-development] type_traits problem
Brought to you by:
mbaas,
roman_yakovenko
From: Allen B. <al...@vr...> - 2006-05-11 23:31:16
|
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? -Allen |