fixed tests and maybe std::is_trivially_default_constructible

This commit is contained in:
Andrzej Krzemienski
2018-06-25 22:50:00 +02:00
parent 42445e94aa
commit 0169460194
3 changed files with 11 additions and 4 deletions

View File

@ -16,8 +16,6 @@
#include <boost/detail/workaround.hpp>
#include <boost/type_traits.hpp>
namespace boost { namespace optional_detail {
// The condition to use POD implementation
#ifdef BOOST_OPTIONAL_CONFIG_NO_POD_SPEC
@ -52,10 +50,12 @@ namespace boost { namespace optional_detail {
#ifndef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
#else
# include <type_traits>
# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) std::is_trivially_default_constructible<T>::value
#endif
namespace boost { namespace optional_detail {
#ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
template <typename T>

View File

@ -140,7 +140,7 @@ void test_map_optional()
void test_map_with_lambda()
{
#ifndef BOOST_NO_CXX11_LAMBDAS
#if !defined BOOST_NO_CXX11_LAMBDAS && !defined BOOST_NO_CXX11_DECLTYPE_N3276
optional<int> oi (1), oj(2);
verify_type<optional<bool> >(oi.map([](int i){ return i == 1; }));
optional<bool> ob = oi.map([](int i){ return i == 1; });

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015 Andrzej Krzemienski.
// Copyright (C) 2015 - 2018 Andrzej Krzemienski.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@ -11,6 +11,7 @@
#include "boost/core/lightweight_test.hpp"
#include "boost/optional/detail/optional_config.hpp"
#include "boost/predef.h"
#include <string>
int main()
@ -37,5 +38,11 @@ int main()
BOOST_TEST_EQ(empty, __GNUC_PATCHLEVEL__);
BOOST_TEST_EQ(empty, __cplusplus);
#endif
BOOST_TEST_EQ(empty, BOOST_COMP_GNUC);
BOOST_TEST_EQ(empty, BOOST_LANG_STDCPP);
BOOST_TEST_EQ(empty, BOOST_LIB_C_GNU);
BOOST_TEST_EQ(empty, BOOST_LIB_STD_CXX);
return boost::report_errors();
}