
5 May
2012
5 May
'12
3:38 a.m.
I noticed that the comparator for a bimap can only be a Functor Type. It does not appear that I can pass a function object or a function pointer, as a STL Set would allow. Is this correct or did I miss something. For my application I could really use the ability to pass in comparator which is decided at runtime. Does anyone have any suggestions on a work around?
I'm not familiar with bimap, but is there a reason you can't wrap a function pointer (that can change at runtime) in a functor? Something like: typedef int (*function_type)(int); struct my_functor { function_type f; // change this at runtime int operator()(int i) { return f(i); } }; Regards, Nate