id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc
2748,[any] implement reset for direct constructing (adapt to noncopyable),nowake@…,nasonov,"I modified boost::any to adapt noncopyable object.
(a) add reset members to construct content directory.
(b) modify boost::any::holder
Sample:
{{{
struct A {
A() : v() {};
A(unsigned int value) : v(value) {};
unsigned int v;
};
BOOST_AUTO_TEST_CASE(test01)
{
any test;
test.reset(10);
BOOST_CHECK_EQUAL(any_cast(test).v, 10);
test.reset();
BOOST_CHECK_EQUAL(test.empty(), true);
}
struct B : boost::noncopyable {
B() : v1(), v2() {};
B(unsigned int value1, unsigned int value2)
: v1(value1) ,v2(value2)
{};
unsigned int v1, v2;
};
BOOST_AUTO_TEST_CASE(test02)
{
any test;
//test = B(); // compile error
//test.reset(10, 20); // compile error
test.reset(10, 20);
//any test2(test); // throw
any test2;
//test2 = test; // throw
BOOST_CHECK_EQUAL(any_cast(test).v1, 10);
BOOST_CHECK_EQUAL(any_cast(test).v2, 20);
}
}}}
",Patches,closed,Boost 1.39.0,any,Boost 1.38.0,Optimization,wontfix,any noncopyable,