I have the following test application:
#include <boost/any.hpp>
#include <iostream>
void check(boost::any y)
{
if (y.empty())
std::cout << "empty!\n";
else
std::cout << "Not empty, type: " << y.type().name() << "\n";
}
int main()
{
boost::any boostAny;
check(boostAny);
boost::any* boostAny2 = &boostAny;
check(boostAny2);
boost::any* boostAny3 = new boost::any;
check(boostAny3);
delete(boostAny3);
}
I compile and run like so:
g++ -std=c++11 -o test test.cpp && ./test
Output is:
empty!
Not empty, type: PN5boost3anyE
Not empty, type: PN5boost3anyE
I would expect for all 3 tests the same output. But it's not. Why? Is this a bug? Tried with boost 1.54.0 and 1.55.0.