Opened 11 years ago
Closed 9 years ago
#6172 closed Feature Requests (wontfix)
let ::boost:: adaptors:: transformed accept raw function pointers too
Reported by: | Owned by: | Neil Groves | |
---|---|---|---|
Milestone: | To Be Determined | Component: | range |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | Cc: |
Description
#include <cstdlib> #include <vector> #include <boost/range/algorithm/find.hpp> #include <boost/range/adaptor/transformed.hpp> #include <boost/mem_fn.hpp> class X { public: int foo () const; }; #define MEM_FN #ifndef MEM_FN #define MEM_FN ::boost:: mem_fn #endif int main () { ::boost:: find (::std:: vector < X > () | ::boost:: adaptors:: transformed (MEM_FN (&X:: foo)), 0); return +EXIT_SUCCESS; }
/usr/include/boost/iterator/transform_iterator.hpp:42:47: error: ‘int (X::*)()const’ is not a class, struct, or union type
Note:
See TracTickets
for help on using tickets.
There is an easier solution that already works. If you just use boost::bind(&X::foo, _1) instead of the MEM_FN macro it works. This also works everywhere else in Boost.Range it accepts a functor without requiring a combinatorial explosion of function overloads.