Typed in place construction added

[SVN r20070]
This commit is contained in:
Fernando Cacciola
2003-09-15 20:28:10 +00:00
parent 161540a0eb
commit 52896b097e
6 changed files with 141 additions and 8 deletions

View File

@ -20,6 +20,7 @@
#include "boost/optional.hpp"
#include "boost/utility/in_place_factory.hpp"
#include "boost/utility/typed_in_place_factory.hpp"
#ifdef __BORLANDC__
#pragma hdrstop
@ -42,16 +43,24 @@ struct A
int test_main( int, char* [] )
{
A a(3.14,"pi");
double a0 = 3.14 ;
std::string a1("pi");
A a(a0,a1);
boost::optional<A> opt1(a);
boost::optional<A> opt2 ( boost::in_place(3.14,"pi") ) ;
boost::optional<A> opt2 ( boost::in_place(a0,a1) ) ;
boost::optional<A> opt3 ( boost::in_place<A>(a0,a1) ) ;
BOOST_CHECK( opt1 == opt2 ) ;
BOOST_CHECK( opt2 == opt2 ) ;
BOOST_CHECK( *opt2 == a ) ;
return 0;
}