forked from boostorg/optional
Typed in place construction added
[SVN r20070]
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user