Added emplace(void) for older compilers

This commit is contained in:
Andrzej Krzemienski
2015-05-15 16:27:40 +02:00
parent 339202a8fb
commit 8ca74951b0
7 changed files with 65 additions and 33 deletions

View File

@ -1,15 +1,16 @@
# Boost.Optional Library test Jamfile
# Boost.Optional Library test Jamfile
#
# Copyright (C) 2003, Fernando Luis Cacciola Carballal.
# Copyright (C) 2003, Fernando Luis Cacciola Carballal.
# Copyright (C) 2014, 2015 Andrzej Krzemienski
#
# This material is provided "as is", with absolutely no warranty expressed
# or implied. Any use is at your own risk.
# Use, modification, and distribution is subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Permission to use or copy this software for any purpose is hereby granted
# without fee, provided the above notices are retained on all copies.
# Permission to modify the code and to distribute modified code is granted,
# provided the above notices are retained, and a notice that the code was
# modified is included with the above copyright notice.
# See http://www.boost.org/libs/optional for documentation.
#
# You are welcome to contact the author at:
# akrzemi1@gmail.com
#
import testing ;

View File

@ -145,11 +145,16 @@ void test_clear_on_throw()
void test_no_assignment_on_emplacement()
{
optional<const std::string> os;
optional<const std::string> os, ot;
BOOST_TEST(!os);
os.emplace("wow");
BOOST_TEST(os);
BOOST_TEST_EQ(*os, "wow");
BOOST_TEST(!ot);
ot.emplace();
BOOST_TEST(ot);
BOOST_TEST_EQ(*ot, "");
}
int main()

View File

@ -15,6 +15,7 @@
//
#include "boost/optional/optional.hpp"
#include "boost/utility/in_place_factory.hpp"
#ifdef __BORLANDC__
#pragma hdrstop