I've made some more investigations. I modified the program slightly to be able to compile it with older gcc and boost versions to see when it broke. Our project uses gcc 4.9.2 with boost 1.55, but when one of my colleagues compiled it on his local machine with gcc 5.2 and boost 1.59 we started to see the issues.
I made a version of the code that's c++03 safe and still exhibits the
On 15-01-16 09:04, Auer, Jens wrote:
problem on all clang/gcc versions I own.
Sadly I can't download boost 1.55 (sf.net is down) and modular boost
doesn't seem to be able to build (headers) in the 1.55 tag...
So maybe you can try this for a spin:
#include <vector>
#include
#include
#include
#include <iostream>
static bool ok = true;
struct SourceEvent
{
unsigned event;
void* ptr;
};
template <typename R>
void test(R const& r) {
ok &= (100u == boost::size(r));
for (typename boost::range_iterator<R>::type it = boost::begin(r);
it != boost::end(r);
++it)
{
ok &= (0u == it->event);
ok &= (0 == it->ptr);
}
}
struct Xfrm {
typedef SourceEvent result_type;
SourceEvent operator()(unsigned) const { SourceEvent se = {};
return se; }
} xfrm_;
SourceEvent xfrm(unsigned) { SourceEvent se = {}; return se; }
int main() {
using boost::adaptors::transformed;
typedef boost::any_range R;
std::vector<int> v(100, 0);
test (v | transformed(xfrm_));
test<R>(v | transformed(xfrm_));
if (ok)
std::cout << "OK" << std::endl;
else
std::cout << "FAIL" << std::endl;
return ok?0:1;
}