
I'm pretty sure I'm have a 'Doh!' moment here, but why does this compile?
Surely the last line of main is gibberish; the value type of m is pair, not
S, so int_from_S
is not a valid function?
#include

I'm pretty sure I'm have a 'Doh!' moment here, but why does this compile?
Surely the last line of main is gibberish; the value type of m is pair, not S, so int_from_S is not a valid function?
#include
#include #include <map> struct S { S( ) { } int i; };
int int_from_S( S s ) { return s.i; }
int main( ) { std::map
m; m[0]=S(); m | boost::adaptors::transformed(int_from_S); } Thx,
- Rob.
Off the top of my head, I would guess that the function(s) that need the value type of the range to be convertible to the argument type of the function don't get instantiated until you actually try to do something with the transformed range. Try std::vector<int> v; boost::push_back(v, m | boost::adaptors::transformed(int_from_S)); and you should see the compiler errors. Regards, Nate
participants (2)
-
Nathan Ridge
-
Robert Jones