mirror of
https://github.com/boostorg/optional.git
synced 2025-07-15 13:26:37 +02:00
Merge branch 'develop' of https://github.com/eldiener/optional into cppbuilder
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:
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
* Fixed [@https://github.com/boostorg/optional/issues/78 issue #78].
|
* Fixed [@https://github.com/boostorg/optional/issues/78 issue #78].
|
||||||
* `boost::none` is now declared as an inline variable (on compilers taht support it): there is only one instance of `boost::none` across all translation units.
|
* `boost::none` is now declared as an inline variable (on compilers taht support it): there is only one instance of `boost::none` across all translation units.
|
||||||
|
* Fixed a number of compilation errors in GCC 4.4.7 in `optional<T>` for trivial `T`s. Thanks to Robert Leahy for the fix. For details see [@https://github.com/boostorg/optional/pull/80 pr #78].
|
||||||
|
* Now surpressing warning `-Wweak-vtables`.
|
||||||
|
|
||||||
[heading Boost Release 1.69]
|
[heading Boost Release 1.69]
|
||||||
|
|
||||||
|
@ -40,6 +40,14 @@
|
|||||||
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> is now declared as an inline variable
|
<code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> is now declared as an inline variable
|
||||||
(on compilers taht support it): there is only one instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> across all translation units.
|
(on compilers taht support it): there is only one instance of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">none</span></code> across all translation units.
|
||||||
</li>
|
</li>
|
||||||
|
<li class="listitem">
|
||||||
|
Fixed a number of compilation errors in GCC 4.4.7 in <code class="computeroutput"><span class="identifier">optional</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span></code> for trivial <code class="computeroutput"><span class="identifier">T</span></code>s.
|
||||||
|
Thanks to Robert Leahy for the fix. For details see <a href="https://github.com/boostorg/optional/pull/80" target="_top">pr
|
||||||
|
#78</a>.
|
||||||
|
</li>
|
||||||
|
<li class="listitem">
|
||||||
|
Now surpressing warning <code class="computeroutput"><span class="special">-</span><span class="identifier">Wweak</span><span class="special">-</span><span class="identifier">vtables</span></code>.
|
||||||
|
</li>
|
||||||
</ul></div>
|
</ul></div>
|
||||||
<h4>
|
<h4>
|
||||||
<a name="boost_optional.relnotes.h1"></a>
|
<a name="boost_optional.relnotes.h1"></a>
|
||||||
|
@ -145,7 +145,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||||
<td align="left"><p><small>Last revised: December 19, 2019 at 23:27:43 GMT</small></p></td>
|
<td align="left"><p><small>Last revised: April 08, 2020 at 23:09:18 GMT</small></p></td>
|
||||||
<td align="right"><div class="copyright-footer"></div></td>
|
<td align="right"><div class="copyright-footer"></div></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
|
#endif
|
||||||
|
|
||||||
class bad_optional_access : public std::logic_error
|
class bad_optional_access : public std::logic_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -27,6 +32,10 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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 >
|
||||||
|
@ -31,10 +31,10 @@ struct Guard
|
|||||||
std::string str;
|
std::string str;
|
||||||
Guard() : num() {}
|
Guard() : num() {}
|
||||||
Guard(double num_, std::string str_) : num(num_), str(str_) {}
|
Guard(double num_, std::string str_) : num(num_), str(str_) {}
|
||||||
|
|
||||||
friend bool operator==(const Guard& lhs, const Guard& rhs) { return lhs.num == rhs.num && lhs.str == rhs.str; }
|
friend bool operator==(const Guard& lhs, const Guard& rhs) { return lhs.num == rhs.num && lhs.str == rhs.str; }
|
||||||
friend bool operator!=(const Guard& lhs, const Guard& rhs) { return !(lhs == rhs); }
|
friend bool operator!=(const Guard& lhs, const Guard& rhs) { return !(lhs == rhs); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Guard(const Guard&);
|
Guard(const Guard&);
|
||||||
Guard& operator=(const Guard&);
|
Guard& operator=(const Guard&);
|
||||||
@ -44,26 +44,30 @@ void test_ctor()
|
|||||||
{
|
{
|
||||||
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
||||||
Guard g0, g1(1.0, "one"), g2(2.0, "two");
|
Guard g0, g1(1.0, "one"), g2(2.0, "two");
|
||||||
|
|
||||||
boost::optional<Guard> og0 ( boost::in_place() );
|
boost::optional<Guard> og0 ( boost::in_place() );
|
||||||
boost::optional<Guard> og1 ( boost::in_place(1.0, "one") );
|
boost::optional<Guard> og1 ( boost::in_place(1.0, "one") );
|
||||||
boost::optional<Guard> og1_( boost::in_place(1.0, "one") );
|
boost::optional<Guard> og1_( boost::in_place(1.0, "one") );
|
||||||
boost::optional<Guard> og2 ( boost::in_place<Guard>(2.0, "two") );
|
boost::optional<Guard> og2 ( boost::in_place<Guard>(2.0, "two") );
|
||||||
|
|
||||||
BOOST_TEST(og0);
|
BOOST_TEST(og0);
|
||||||
BOOST_TEST(og1);
|
BOOST_TEST(og1);
|
||||||
BOOST_TEST(og1_);
|
BOOST_TEST(og1_);
|
||||||
BOOST_TEST(og2);
|
BOOST_TEST(og2);
|
||||||
|
|
||||||
BOOST_TEST(*og0 == g0);
|
BOOST_TEST(*og0 == g0);
|
||||||
BOOST_TEST(*og1 == g1);
|
BOOST_TEST(*og1 == g1);
|
||||||
BOOST_TEST(*og1_ == g1);
|
BOOST_TEST(*og1_ == g1);
|
||||||
BOOST_TEST(*og2 == g2);
|
BOOST_TEST(*og2 == g2);
|
||||||
|
|
||||||
BOOST_TEST(og1_ == og1);
|
BOOST_TEST(og1_ == og1);
|
||||||
BOOST_TEST(og1_ != og2);
|
BOOST_TEST(og1_ != og2);
|
||||||
BOOST_TEST(og1_ != og0);
|
BOOST_TEST(og1_ != og0);
|
||||||
#endif
|
|
||||||
|
boost::optional<unsigned int> o( boost::in_place(5) );
|
||||||
|
BOOST_TEST(o);
|
||||||
|
BOOST_TEST(*o == 5);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_assign()
|
void test_assign()
|
||||||
@ -71,27 +75,32 @@ void test_assign()
|
|||||||
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
|
||||||
#ifndef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
|
#ifndef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
|
||||||
Guard g0, g1(1.0, "one"), g2(2.0, "two");
|
Guard g0, g1(1.0, "one"), g2(2.0, "two");
|
||||||
|
|
||||||
boost::optional<Guard> og0, og1, og1_, og2;
|
boost::optional<Guard> og0, og1, og1_, og2;
|
||||||
|
|
||||||
og0 = boost::in_place();
|
og0 = boost::in_place();
|
||||||
og1 = boost::in_place(1.0, "one");
|
og1 = boost::in_place(1.0, "one");
|
||||||
og1_ = boost::in_place(1.0, "one");
|
og1_ = boost::in_place(1.0, "one");
|
||||||
og2 = boost::in_place<Guard>(2.0, "two");
|
og2 = boost::in_place<Guard>(2.0, "two");
|
||||||
|
|
||||||
BOOST_TEST(og0);
|
BOOST_TEST(og0);
|
||||||
BOOST_TEST(og1);
|
BOOST_TEST(og1);
|
||||||
BOOST_TEST(og1_);
|
BOOST_TEST(og1_);
|
||||||
BOOST_TEST(og2);
|
BOOST_TEST(og2);
|
||||||
|
|
||||||
BOOST_TEST(*og0 == g0);
|
BOOST_TEST(*og0 == g0);
|
||||||
BOOST_TEST(*og1 == g1);
|
BOOST_TEST(*og1 == g1);
|
||||||
BOOST_TEST(*og1_ == g1);
|
BOOST_TEST(*og1_ == g1);
|
||||||
BOOST_TEST(*og2 == g2);
|
BOOST_TEST(*og2 == g2);
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
@ -101,4 +110,4 @@ int main()
|
|||||||
test_ctor();
|
test_ctor();
|
||||||
test_assign();
|
test_assign();
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -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