
Dear all, According to the Boost.Type_Traits I guess that function_traits<> is supposed to be of the most docile ones. After all it's got a few lines of comment... Don't know how, and why, but the following plain-jane programme #include <iostream> #include "boost\type_traits\function_traits.hpp" int main() { typedef void (*FType) (); typedef typename boost::function_traits<FType> ::result_type return_type; cin.get(); return 0; } Gives me the following error under GCC 3.3.1 (which I'm sure supports partial template specialisation): Compiler: Default compiler Building Makefile: "C:\Documents and Settings\Hossein\My Documents\My Programmes\Probability I\Distributions\7.2.1\Makefile.win" Executing make... make.exe -f "C:\Documents and Settings\Hossein\My Documents\My Programmes\Probability I\Distributions\7.2.1\Makefile.win" all g++.exe -D__DEBUG__ -c 7_2_1Main.cpp -o 7_2_1Main.o -I"C:/Dev-Cpp/include/c++/3.3.1" -I"C:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"C:/Dev-Cpp/include/c++/3.3.1/backward" -I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"C:/Dev-Cpp/include" -pg -g3 7_2_1Main.cpp: In instantiation of `boost::function_traits<void (*)()>': 7_2_1Main.cpp:57: instantiated from here 7_2_1Main.cpp:57: error: base class `boost::detail::function_traits_helper<void (**)()>' has incomplete type 7_2_1Main.cpp: In function `int main()': 7_2_1Main.cpp:57: error: no type named `result_type' in `struct boost::function_traits<void (*)()>' 7_2_1Main.cpp:57: error: using `typename' outside of template 7_2_1Main.cpp:57: error: ISO C++ forbids declaration of `return_type' with no type make.exe: *** [7_2_1Main.o] Error 1 Execution terminated Is he right? Is there anything particular I should had done, and I've not? TIA, --Hossein __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail

Hossein Haeri writes:
Dear all,
According to the Boost.Type_Traits I guess that function_traits<> is supposed to be of the most docile ones. After all it's got a few lines of comment...
Don't know how, and why, but the following plain-jane programme
#include <iostream> #include "boost\type_traits\function_traits.hpp"
int main() { typedef void (*FType) (); ^
Should be typedef void (FType) ();
typedef typename boost::function_traits<FType> ::result_type return_type;
cin.get(); return 0; }
Gives me the following error under GCC 3.3.1 (which I'm sure supports partial template specialisation):
[...]
Is he right? Is there anything particular I should had done, and I've not?
'function_traits' requires you to pass a _function type_, which is a different beast from a pointer to a function. HTH, -- Aleksey Gurtovoy MetaCommunications Engineering

Aleksey,
int main() { typedef void (*FType) (); ^
Should be
typedef void (FType) ();
Aha! I tested it and it was fine. :)
typedef typename boost::function_traits<FType> ::result_type return_type;
cin.get(); return 0; } ... Is he right? Is there anything particular I should had done, and I've not?
'function_traits' requires you to pass a _function type_, which is a different beast from a pointer to a function.
I see. You know for sure that we C/C++ programmers are "used to" work with function pointer (types), as this is how we pass them around, if any! (Excluding Functors, I mean.) Very nice answer indeed. Bunches of Thanks, Mery Chistmas, --Hossein __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail
participants (2)
-
Aleksey Gurtovoy
-
Hossein Haeri