Ticket #12615: any_patch.txt

File any_patch.txt, 1.3 KB (added by vishalshetye@…, 6 years ago)

sample patch

Line 
1--- any.hpp 2016-11-21 14:50:49.000000000 +0530
2+++ any_patched.hpp 2016-11-21 14:49:58.000000000 +0530
3@@ -15,6 +15,7 @@
4 // when: July 2001, April 2013 - May 2013
5
6 #include <algorithm>
7+#include <memory>
8
9 #include "boost/config.hpp"
10 #include <boost/type_index.hpp>
11@@ -244,7 +245,7 @@
12 ValueType * any_cast(any * operand) BOOST_NOEXCEPT
13 {
14 return operand && operand->type() == boost::typeindex::type_id<ValueType>()
15- ? &static_cast<any::holder<BOOST_DEDUCED_TYPENAME remove_cv<ValueType>::type> *>(operand->content)->held
16+ ? std::addressof(static_cast<any::holder<BOOST_DEDUCED_TYPENAME remove_cv<ValueType>::type> *>(operand->content)->held)
17 : 0;
18 }
19
20@@ -260,7 +261,7 @@
21 typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
22
23
24- nonref * result = any_cast<nonref>(&operand);
25+ nonref * result = any_cast<nonref>(std::addressof(operand));
26 if(!result)
27 boost::throw_exception(bad_any_cast());
28
29@@ -306,7 +307,7 @@
30 template<typename ValueType>
31 inline ValueType * unsafe_any_cast(any * operand) BOOST_NOEXCEPT
32 {
33- return &static_cast<any::holder<ValueType> *>(operand->content)->held;
34+ return std::addressof(static_cast<any::holder<ValueType> *>(operand->content)->held);
35 }
36
37 template<typename ValueType>