|
Boost Users : |
Subject: [Boost-users] [Range] Predicate type checking.
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2012-05-02 08:13:10
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 <boost/range.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <map>
struct S
{
S( ) { }
int i;
};
int int_from_S( S s ) { return s.i; }
int main( )
{
std::map<unsigned, S> m;
m[0]=S();
m | boost::adaptors::transformed(int_from_S);
}
Thx,
- Rob.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net