mirror of
https://github.com/boostorg/optional.git
synced 2025-07-15 13:26:37 +02:00
Merge branch 'develop' of https://github.com/RobertLeahy/optional-2 into RobertLeahy-develop
This commit is contained in:
@ -151,6 +151,7 @@ matrix:
|
|||||||
- llvm-toolchain-precise-3.9
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
compiler: clang++-4.0
|
compiler: clang++-4.0
|
||||||
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
@ -162,6 +163,7 @@ matrix:
|
|||||||
- llvm-toolchain-trusty-4.0
|
- llvm-toolchain-trusty-4.0
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
compiler: clang++-5.0
|
compiler: clang++-5.0
|
||||||
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
|
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
|
||||||
addons:
|
addons:
|
||||||
|
@ -359,7 +359,7 @@ class tc_optional_base : public optional_tag
|
|||||||
template<class Expr>
|
template<class Expr>
|
||||||
void construct ( Expr const& factory, in_place_factory_base const* )
|
void construct ( Expr const& factory, in_place_factory_base const* )
|
||||||
{
|
{
|
||||||
boost_optional_detail::construct<value_type>(factory, m_storage.address());
|
boost_optional_detail::construct<value_type>(factory, boost::addressof(m_storage));
|
||||||
m_initialized = true ;
|
m_initialized = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,14 @@ struct size_tag {};
|
|||||||
template< typename T, typename U >
|
template< typename T, typename U >
|
||||||
struct is_constructible
|
struct is_constructible
|
||||||
{
|
{
|
||||||
template< typename T1, typename U1 >
|
static U& get();
|
||||||
static yes_type check_helper(size_tag< sizeof(static_cast< T1 >(U1())) >*);
|
|
||||||
template< typename T1, typename U1 >
|
template< typename T1 >
|
||||||
|
static yes_type check_helper(size_tag< sizeof(static_cast< T1 >(get())) >*);
|
||||||
|
template< typename T1 >
|
||||||
static no_type check_helper(...);
|
static no_type check_helper(...);
|
||||||
|
|
||||||
static const bool value = sizeof(check_helper< T, U >(0)) == sizeof(yes_type);
|
static const bool value = sizeof(check_helper< T >(0)) == sizeof(yes_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
@ -63,6 +63,10 @@ void test_ctor()
|
|||||||
BOOST_TEST(og1_ == og1);
|
BOOST_TEST(og1_ == og1);
|
||||||
BOOST_TEST(og1_ != og2);
|
BOOST_TEST(og1_ != og2);
|
||||||
BOOST_TEST(og1_ != og0);
|
BOOST_TEST(og1_ != og0);
|
||||||
|
|
||||||
|
boost::optional<unsigned int> o( boost::in_place(5) );
|
||||||
|
BOOST_TEST(o);
|
||||||
|
BOOST_TEST(*o == 5);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +96,11 @@ void test_assign()
|
|||||||
BOOST_TEST(og1_ == og1);
|
BOOST_TEST(og1_ == og1);
|
||||||
BOOST_TEST(og1_ != og2);
|
BOOST_TEST(og1_ != og2);
|
||||||
BOOST_TEST(og1_ != og0);
|
BOOST_TEST(og1_ != og0);
|
||||||
|
|
||||||
|
boost::optional<unsigned int> o;
|
||||||
|
o = boost::in_place(5);
|
||||||
|
BOOST_TEST(o);
|
||||||
|
BOOST_TEST(*o == 5);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT
|
||||||
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
template <typename, typename>
|
template <typename, typename>
|
||||||
struct void_t
|
struct void_t
|
||||||
{
|
{
|
||||||
@ -49,6 +51,8 @@ struct Path
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -93,7 +93,9 @@ template <typename T>
|
|||||||
void test_all_const_cases()
|
void test_all_const_cases()
|
||||||
{
|
{
|
||||||
test_converting_ctor<T>();
|
test_converting_ctor<T>();
|
||||||
|
#ifndef BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT
|
||||||
test_converting_ctor<const T>();
|
test_converting_ctor<const T>();
|
||||||
|
#endif
|
||||||
test_converting_ctor_for_noconst_const<T>();
|
test_converting_ctor_for_noconst_const<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user