mirror of
https://github.com/boostorg/optional.git
synced 2025-07-15 05:16:36 +02:00
fixed tests and maybe std::is_trivially_default_constructible
This commit is contained in:
@ -15,8 +15,6 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/type_traits.hpp>
|
#include <boost/type_traits.hpp>
|
||||||
|
|
||||||
namespace boost { namespace optional_detail {
|
|
||||||
|
|
||||||
// The condition to use POD implementation
|
// The condition to use POD implementation
|
||||||
|
|
||||||
@ -52,10 +50,12 @@ namespace boost { namespace optional_detail {
|
|||||||
#ifndef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
|
#ifndef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS
|
||||||
# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||||
#else
|
#else
|
||||||
|
# include <type_traits>
|
||||||
# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) std::is_trivially_default_constructible<T>::value
|
# define BOOST_OPTIONAL_DETAIL_HAS_TRIVIAL_CTOR(T) std::is_trivially_default_constructible<T>::value
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace boost { namespace optional_detail {
|
||||||
|
|
||||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_SPEC_FOR_TRIVIAL_TYPES
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -140,7 +140,7 @@ void test_map_optional()
|
|||||||
|
|
||||||
void test_map_with_lambda()
|
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);
|
optional<int> oi (1), oj(2);
|
||||||
verify_type<optional<bool> >(oi.map([](int i){ return i == 1; }));
|
verify_type<optional<bool> >(oi.map([](int i){ return i == 1; }));
|
||||||
optional<bool> ob = oi.map([](int i){ return i == 1; });
|
optional<bool> ob = oi.map([](int i){ return i == 1; });
|
||||||
|
@ -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
|
// Use, modification, and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// 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/core/lightweight_test.hpp"
|
||||||
#include "boost/optional/detail/optional_config.hpp"
|
#include "boost/optional/detail/optional_config.hpp"
|
||||||
|
#include "boost/predef.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@ -37,5 +38,11 @@ int main()
|
|||||||
BOOST_TEST_EQ(empty, __GNUC_PATCHLEVEL__);
|
BOOST_TEST_EQ(empty, __GNUC_PATCHLEVEL__);
|
||||||
BOOST_TEST_EQ(empty, __cplusplus);
|
BOOST_TEST_EQ(empty, __cplusplus);
|
||||||
#endif
|
#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();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user