
AMDG On 2/4/2011 1:53 AM, nicolas david wrote:
I am using boost::function and have some issues on using it with visual studio 2005. If I declare a boost::function with some "const" argument this "constness" seems to be lost on boost function siganture. Then, future assigment to this function whith correct "const" argument lead to wrong matching. See code snipset below. This work fine under gcc 4.4 and visual 2010.
---------------------------------------------------------------------------------- <snip> class container_test { public: typedef boost::function
FunctionType; bool static defaultFunctor(const int, float, float) { return true; } //void apply_functor( const FunctionType IsInside = defaultFunctor){} }; <snip> ---------------------------------------------------------------------------------- error send by visual 2005 compiler with "const". If change "const int" to "int" it works. ( sorry for the "french")
This is a compiler bug. Whether the argument is declared const shouldn't affect anything outside of the function body. bool static defaultFunctor(const int, float, float); is exactly equivalent to bool static defaultFunctor(int, float, float); In Christ, Steven Watanabe