Coverage Report

Created: 2026-04-10 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/boost/boost/any.hpp
Line
Count
Source
1
// See http://www.boost.org/libs/any for Documentation.
2
3
#ifndef BOOST_ANY_INCLUDED
4
#define BOOST_ANY_INCLUDED
5
6
#include <boost/any/detail/config.hpp>
7
8
#if !defined(BOOST_USE_MODULES) || defined(BOOST_ANY_INTERFACE_UNIT)
9
10
/// \file boost/any.hpp
11
/// \brief \copybrief boost::any
12
13
#ifndef BOOST_ANY_INTERFACE_UNIT
14
#include <boost/config.hpp>
15
#ifdef BOOST_HAS_PRAGMA_ONCE
16
# pragma once
17
#endif
18
19
#include <memory>  // for std::addressof
20
#include <type_traits>
21
22
#include <boost/throw_exception.hpp>
23
#include <boost/type_index.hpp>
24
25
#endif  // #ifndef BOOST_ANY_INTERFACE_UNIT
26
27
// what:  variant type boost::any
28
// who:   contributed by Kevlin Henney,
29
//        with features contributed and bugs found by
30
//        Antony Polukhin, Ed Brey, Mark Rodgers,
31
//        Peter Dimov, and James Curran
32
// when:  July 2001, April 2013 - 2020
33
34
#include <boost/any/bad_any_cast.hpp>
35
#include <boost/any/fwd.hpp>
36
#include <boost/any/detail/placeholder.hpp>
37
38
namespace boost {
39
40
BOOST_ANY_BEGIN_MODULE_EXPORT
41
42
    /// \brief A class whose instances can hold instances of any
43
    /// type that satisfies \forcedlink{ValueType} requirements.
44
    class any
45
    {
46
    public:
47
48
        /// \post this->empty() is true.
49
        constexpr any() noexcept
50
422k
          : content(0)
51
422k
        {
52
422k
        }
53
54
        /// Makes a copy of `value`, so
55
        /// that the initial content of the new instance is equivalent
56
        /// in both type and value to `value`.
57
        ///
58
        /// \throws std::bad_alloc or any exceptions arising from the copy
59
        /// constructor of the contained type.
60
        template<typename ValueType>
61
        any(const ValueType & value)
62
767k
          : content(new holder<
63
767k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
767k
            >(value))
65
767k
        {
66
767k
            static_assert(
67
767k
                !anys::detail::is_basic_any<ValueType>::value,
68
767k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
767k
            );
70
767k
        }
boost::any::any<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
62
348k
          : content(new holder<
63
348k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
348k
            >(value))
65
348k
        {
66
348k
            static_assert(
67
348k
                !anys::detail::is_basic_any<ValueType>::value,
68
348k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
348k
            );
70
348k
        }
boost::any::any<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::no_property>, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>*>(boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::no_property>, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>* const&)
Line
Count
Source
62
10.3k
          : content(new holder<
63
10.3k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
10.3k
            >(value))
65
10.3k
        {
66
10.3k
            static_assert(
67
10.3k
                !anys::detail::is_basic_any<ValueType>::value,
68
10.3k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
10.3k
            );
70
10.3k
        }
boost::any::any<bool>(bool const&)
Line
Count
Source
62
30.0k
          : content(new holder<
63
30.0k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
30.0k
            >(value))
65
30.0k
        {
66
30.0k
            static_assert(
67
30.0k
                !anys::detail::is_basic_any<ValueType>::value,
68
30.0k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
30.0k
            );
70
30.0k
        }
boost::any::any<int>(int const&)
Line
Count
Source
62
2.20k
          : content(new holder<
63
2.20k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
2.20k
            >(value))
65
2.20k
        {
66
2.20k
            static_assert(
67
2.20k
                !anys::detail::is_basic_any<ValueType>::value,
68
2.20k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
2.20k
            );
70
2.20k
        }
boost::any::any<long>(long const&)
Line
Count
Source
62
2.17k
          : content(new holder<
63
2.17k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
2.17k
            >(value))
65
2.17k
        {
66
2.17k
            static_assert(
67
2.17k
                !anys::detail::is_basic_any<ValueType>::value,
68
2.17k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
2.17k
            );
70
2.17k
        }
boost::any::any<float>(float const&)
Line
Count
Source
62
4.78k
          : content(new holder<
63
4.78k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
4.78k
            >(value))
65
4.78k
        {
66
4.78k
            static_assert(
67
4.78k
                !anys::detail::is_basic_any<ValueType>::value,
68
4.78k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
4.78k
            );
70
4.78k
        }
boost::any::any<double>(double const&)
Line
Count
Source
62
7.54k
          : content(new holder<
63
7.54k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
7.54k
            >(value))
65
7.54k
        {
66
7.54k
            static_assert(
67
7.54k
                !anys::detail::is_basic_any<ValueType>::value,
68
7.54k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
7.54k
            );
70
7.54k
        }
boost::any::any<unsigned long>(unsigned long const&)
Line
Count
Source
62
26.5k
          : content(new holder<
63
26.5k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
26.5k
            >(value))
65
26.5k
        {
66
26.5k
            static_assert(
67
26.5k
                !anys::detail::is_basic_any<ValueType>::value,
68
26.5k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
26.5k
            );
70
26.5k
        }
boost::any::any<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >(boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> const&)
Line
Count
Source
62
330k
          : content(new holder<
63
330k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
330k
            >(value))
65
330k
        {
66
330k
            static_assert(
67
330k
                !anys::detail::is_basic_any<ValueType>::value,
68
330k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
330k
            );
70
330k
        }
boost::any::any<boost::property_tree::string_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::property_tree::id_translator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >(boost::property_tree::string_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::property_tree::id_translator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)
Line
Count
Source
62
1.99k
          : content(new holder<
63
1.99k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
1.99k
            >(value))
65
1.99k
        {
66
1.99k
            static_assert(
67
1.99k
                !anys::detail::is_basic_any<ValueType>::value,
68
1.99k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
1.99k
            );
70
1.99k
        }
Unexecuted instantiation: boost::any::any<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
boost::any::any<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, DotVertex, DotEdge, boost::no_property, boost::listS>*>(boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, DotVertex, DotEdge, boost::no_property, boost::listS>* const&)
Line
Count
Source
62
3.07k
          : content(new holder<
63
3.07k
                typename std::remove_cv<typename std::decay<const ValueType>::type>::type
64
3.07k
            >(value))
65
3.07k
        {
66
3.07k
            static_assert(
67
3.07k
                !anys::detail::is_basic_any<ValueType>::value,
68
3.07k
                "boost::any shall not be constructed from boost::anys::basic_any"
69
3.07k
            );
70
3.07k
        }
71
72
        /// Copy constructor that copies content of
73
        /// `other` into new instance, so that any content
74
        /// is equivalent in both type and value to the content of
75
        /// `other`, or empty if `other` is empty.
76
        ///
77
        /// \throws May fail with a `std::bad_alloc`
78
        /// exception or any exceptions arising from the copy
79
        /// constructor of the contained type.
80
        any(const any & other)
81
236k
          : content(other.content ? other.content->clone() : 0)
82
236k
        {
83
236k
        }
84
85
        /// Move constructor that moves content of
86
        /// `other` into new instance and leaves `other` empty.
87
        ///
88
        /// \post other->empty() is true
89
        /// \throws Nothing.
90
        any(any&& other) noexcept
91
73.2k
          : content(other.content)
92
73.2k
        {
93
73.2k
            other.content = 0;
94
73.2k
        }
95
96
        /// Forwards `value`, so
97
        /// that the initial content of the new instance is equivalent
98
        /// in both type and value to `value` before the forward.
99
        ///
100
        /// \throws std::bad_alloc or any exceptions arising from the move or
101
        /// copy constructor of the contained type.
102
        template<typename ValueType>
103
        any(ValueType&& value
104
            , typename std::enable_if<!std::is_same<any&, ValueType>::value >::type* = 0 // disable if value has type `any&`
105
            , typename std::enable_if<!std::is_const<ValueType>::value >::type* = 0) // disable if value has type `const ValueType&&`
106
43.1k
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
43.1k
        {
108
43.1k
            static_assert(
109
43.1k
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
43.1k
                "boost::any shall not be constructed from boost::anys::basic_any"
111
43.1k
            );
112
43.1k
        }
_ZN5boost3anyC2ImEEOT_PNSt3__19enable_ifIXntsr3std7is_sameIRS0_S2_EE5valueEvE4typeEPNS5_IXntsr8is_constIS2_EE5valueEvE4typeE
Line
Count
Source
106
8.35k
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
8.35k
        {
108
8.35k
            static_assert(
109
8.35k
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
8.35k
                "boost::any shall not be constructed from boost::anys::basic_any"
111
8.35k
            );
112
8.35k
        }
_ZN5boost3anyC2IRNS_6detail14edge_desc_implINS_12directed_tagEmEEEEOT_PNSt3__19enable_ifIXntsr3std7is_sameIRS0_S7_EE5valueEvE4typeEPNSA_IXntsr8is_constIS7_EE5valueEvE4typeE
Line
Count
Source
106
32.1k
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
32.1k
        {
108
32.1k
            static_assert(
109
32.1k
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
32.1k
                "boost::any shall not be constructed from boost::anys::basic_any"
111
32.1k
            );
112
32.1k
        }
_ZN5boost3anyC2IiEEOT_PNSt3__19enable_ifIXntsr3std7is_sameIRS0_S2_EE5valueEvE4typeEPNS5_IXntsr8is_constIS2_EE5valueEvE4typeE
Line
Count
Source
106
807
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
807
        {
108
807
            static_assert(
109
807
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
807
                "boost::any shall not be constructed from boost::anys::basic_any"
111
807
            );
112
807
        }
_ZN5boost3anyC2IfEEOT_PNSt3__19enable_ifIXntsr3std7is_sameIRS0_S2_EE5valueEvE4typeEPNS5_IXntsr8is_constIS2_EE5valueEvE4typeE
Line
Count
Source
106
994
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
994
        {
108
994
            static_assert(
109
994
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
994
                "boost::any shall not be constructed from boost::anys::basic_any"
111
994
            );
112
994
        }
_ZN5boost3anyC2IdEEOT_PNSt3__19enable_ifIXntsr3std7is_sameIRS0_S2_EE5valueEvE4typeEPNS5_IXntsr8is_constIS2_EE5valueEvE4typeE
Line
Count
Source
106
127
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
127
        {
108
127
            static_assert(
109
127
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
127
                "boost::any shall not be constructed from boost::anys::basic_any"
111
127
            );
112
127
        }
_ZN5boost3anyC2IbEEOT_PNSt3__19enable_ifIXntsr3std7is_sameIRS0_S2_EE5valueEvE4typeEPNS5_IXntsr8is_constIS2_EE5valueEvE4typeE
Line
Count
Source
106
671
          : content(new holder< typename std::decay<ValueType>::type >(std::forward<ValueType>(value)))
107
671
        {
108
671
            static_assert(
109
671
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
110
671
                "boost::any shall not be constructed from boost::anys::basic_any"
111
671
            );
112
671
        }
Unexecuted instantiation: _ZN5boost3anyC2IRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEOT_PNS2_9enable_ifIXntsr3std7is_sameIRS0_SA_EE5valueEvE4typeEPNSC_IXntsr8is_constISA_EE5valueEvE4typeE
113
114
        /// Releases any and all resources used in management of instance.
115
        ///
116
        /// \throws Nothing.
117
        ~any() noexcept
118
1.54M
        {
119
1.54M
            delete content;
120
1.54M
        }
121
122
    public: // modifiers
123
124
        /// Exchange of the contents of `*this` and `rhs`.
125
        ///
126
        /// \returns `*this`
127
        /// \throws Nothing.
128
        any & swap(any & rhs) noexcept
129
270k
        {
130
270k
            placeholder* tmp = content;
131
270k
            content = rhs.content;
132
270k
            rhs.content = tmp;
133
270k
            return *this;
134
270k
        }
135
136
        /// Copies content of `rhs` into
137
        /// current instance, discarding previous content, so that the
138
        /// new content is equivalent in both type and value to the
139
        /// content of `rhs`, or empty if `rhs.empty()`.
140
        ///
141
        /// \throws std::bad_alloc
142
        /// or any exceptions arising from the copy constructor of the
143
        /// contained type. Assignment satisfies the strong guarantee
144
        /// of exception safety.
145
        any & operator=(const any& rhs)
146
45.3k
        {
147
45.3k
            any(rhs).swap(*this);
148
45.3k
            return *this;
149
45.3k
        }
150
151
        /// Moves content of `rhs` into
152
        /// current instance, discarding previous content, so that the
153
        /// new content is equivalent in both type and value to the
154
        /// content of `rhs` before move, or empty if
155
        /// `rhs.empty()`.
156
        ///
157
        /// \post `rhs->empty()` is true
158
        /// \throws Nothing.
159
        any & operator=(any&& rhs) noexcept
160
112k
        {
161
112k
            rhs.swap(*this);
162
112k
            any().swap(rhs);
163
112k
            return *this;
164
112k
        }
165
166
        /// Forwards `rhs`,
167
        /// discarding previous content, so that the new content of is
168
        /// equivalent in both type and value to
169
        /// `rhs` before forward.
170
        ///
171
        /// \throws std::bad_alloc
172
        /// or any exceptions arising from the move or copy constructor of the
173
        /// contained type. Assignment satisfies the strong guarantee
174
        /// of exception safety.
175
        template <class ValueType>
176
        any & operator=(ValueType&& rhs)
177
0
        {
178
0
            static_assert(
179
0
                !anys::detail::is_basic_any<typename std::decay<ValueType>::type>::value,
180
0
                "boost::anys::basic_any shall not be assigned into boost::any"
181
0
            );
182
0
            any(std::forward<ValueType>(rhs)).swap(*this);
183
0
            return *this;
184
0
        }
185
186
    public: // queries
187
188
        /// \returns `true` if instance is empty, otherwise `false`.
189
        /// \throws Nothing.
190
        bool empty() const noexcept
191
43.9k
        {
192
43.9k
            return !content;
193
43.9k
        }
194
195
        /// \post this->empty() is true
196
        void clear() noexcept
197
0
        {
198
0
            any().swap(*this);
199
0
        }
200
201
        /// \returns the `typeid` of the
202
        /// contained value if instance is non-empty, otherwise
203
        /// `typeid(void)`.
204
        ///
205
        /// Useful for querying against types known either at compile time or
206
        /// only at runtime.
207
        const boost::typeindex::type_info& type() const noexcept
208
125k
        {
209
125k
            return content ? content->type() : boost::typeindex::type_id<void>().type_info();
210
125k
        }
211
212
    private: // types
213
        /// @cond
214
        class BOOST_SYMBOL_VISIBLE placeholder: public boost::anys::detail::placeholder
215
        {
216
        public:
217
            virtual placeholder * clone() const = 0;
218
        };
219
220
        template<typename ValueType>
221
        class holder final
222
          : public placeholder
223
        {
224
        public: // structors
225
226
            holder(const ValueType & value)
227
785k
              : held(value)
228
1.03M
            {
229
1.03M
            }
boost::any::holder<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::holder(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
227
348k
              : held(value)
228
348k
            {
229
348k
            }
boost::any::holder<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >::holder(boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> const&)
Line
Count
Source
227
433k
              : held(value)
228
433k
            {
229
433k
            }
boost::any::holder<boost::property_tree::string_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::property_tree::id_translator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::holder(boost::property_tree::string_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::property_tree::id_translator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)
Line
Count
Source
227
3.99k
              : held(value)
228
3.99k
            {
229
3.99k
            }
Unexecuted instantiation: boost::any::holder<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >::holder(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&)
boost::any::holder<unsigned long>::holder(unsigned long const&)
Line
Count
Source
227
164k
              : held(value)
228
164k
            {
229
164k
            }
boost::any::holder<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::no_property>, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>*>::holder(boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::no_property>, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>* const&)
Line
Count
Source
227
10.3k
              : held(value)
228
10.3k
            {
229
10.3k
            }
boost::any::holder<bool>::holder(bool const&)
Line
Count
Source
227
56.4k
              : held(value)
228
56.4k
            {
229
56.4k
            }
boost::any::holder<int>::holder(int const&)
Line
Count
Source
227
2.20k
              : held(value)
228
2.20k
            {
229
2.20k
            }
boost::any::holder<long>::holder(long const&)
Line
Count
Source
227
2.17k
              : held(value)
228
2.17k
            {
229
2.17k
            }
boost::any::holder<float>::holder(float const&)
Line
Count
Source
227
4.78k
              : held(value)
228
4.78k
            {
229
4.78k
            }
boost::any::holder<double>::holder(double const&)
Line
Count
Source
227
7.54k
              : held(value)
228
7.54k
            {
229
7.54k
            }
boost::any::holder<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, DotVertex, DotEdge, boost::no_property, boost::listS>*>::holder(boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, DotVertex, DotEdge, boost::no_property, boost::listS>* const&)
Line
Count
Source
227
3.07k
              : held(value)
228
3.07k
            {
229
3.07k
            }
230
231
            holder(ValueType&& value)
232
10.9k
              : held(static_cast< ValueType&& >(value))
233
10.9k
            {
234
10.9k
            }
boost::any::holder<unsigned long>::holder(unsigned long&&)
Line
Count
Source
232
8.35k
              : held(static_cast< ValueType&& >(value))
233
8.35k
            {
234
8.35k
            }
boost::any::holder<int>::holder(int&&)
Line
Count
Source
232
807
              : held(static_cast< ValueType&& >(value))
233
807
            {
234
807
            }
boost::any::holder<float>::holder(float&&)
Line
Count
Source
232
994
              : held(static_cast< ValueType&& >(value))
233
994
            {
234
994
            }
boost::any::holder<double>::holder(double&&)
Line
Count
Source
232
127
              : held(static_cast< ValueType&& >(value))
233
127
            {
234
127
            }
boost::any::holder<bool>::holder(bool&&)
Line
Count
Source
232
671
              : held(static_cast< ValueType&& >(value))
233
671
            {
234
671
            }
235
236
        public: // queries
237
238
            const boost::typeindex::type_info& type() const noexcept override
239
125k
            {
240
125k
                return boost::typeindex::type_id<ValueType>().type_info();
241
125k
            }
boost::any::holder<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::type() const
Line
Count
Source
239
20.7k
            {
240
20.7k
                return boost::typeindex::type_id<ValueType>().type_info();
241
20.7k
            }
boost::any::holder<unsigned long>::type() const
Line
Count
Source
239
83.4k
            {
240
83.4k
                return boost::typeindex::type_id<ValueType>().type_info();
241
83.4k
            }
boost::any::holder<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >::type() const
Line
Count
Source
239
6.17k
            {
240
6.17k
                return boost::typeindex::type_id<ValueType>().type_info();
241
6.17k
            }
Unexecuted instantiation: boost::any::holder<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::no_property>, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>*>::type() const
boost::any::holder<bool>::type() const
Line
Count
Source
239
13.7k
            {
240
13.7k
                return boost::typeindex::type_id<ValueType>().type_info();
241
13.7k
            }
boost::any::holder<int>::type() const
Line
Count
Source
239
680
            {
240
680
                return boost::typeindex::type_id<ValueType>().type_info();
241
680
            }
Unexecuted instantiation: boost::any::holder<long>::type() const
boost::any::holder<float>::type() const
Line
Count
Source
239
818
            {
240
818
                return boost::typeindex::type_id<ValueType>().type_info();
241
818
            }
boost::any::holder<double>::type() const
Line
Count
Source
239
115
            {
240
115
                return boost::typeindex::type_id<ValueType>().type_info();
241
115
            }
Unexecuted instantiation: boost::any::holder<boost::property_tree::string_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::property_tree::id_translator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::type() const
Unexecuted instantiation: boost::any::holder<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >::type() const
Unexecuted instantiation: boost::any::holder<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, DotVertex, DotEdge, boost::no_property, boost::listS>*>::type() const
242
243
            placeholder * clone() const BOOST_OVERRIDE
244
236k
            {
245
236k
                return new holder(held);
246
236k
            }
Unexecuted instantiation: boost::any::holder<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::clone() const
boost::any::holder<unsigned long>::clone() const
Line
Count
Source
244
137k
            {
245
137k
                return new holder(held);
246
137k
            }
boost::any::holder<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >::clone() const
Line
Count
Source
244
70.5k
            {
245
70.5k
                return new holder(held);
246
70.5k
            }
Unexecuted instantiation: boost::any::holder<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::property<boost::vertex_name_t, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::no_property>, boost::property<boost::edge_weight_t, double, boost::no_property>, boost::no_property, boost::listS>*>::clone() const
boost::any::holder<bool>::clone() const
Line
Count
Source
244
26.3k
            {
245
26.3k
                return new holder(held);
246
26.3k
            }
Unexecuted instantiation: boost::any::holder<int>::clone() const
Unexecuted instantiation: boost::any::holder<long>::clone() const
Unexecuted instantiation: boost::any::holder<float>::clone() const
Unexecuted instantiation: boost::any::holder<double>::clone() const
boost::any::holder<boost::property_tree::string_path<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::property_tree::id_translator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >::clone() const
Line
Count
Source
244
1.99k
            {
245
1.99k
                return new holder(held);
246
1.99k
            }
Unexecuted instantiation: boost::any::holder<std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > >::clone() const
Unexecuted instantiation: boost::any::holder<boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, DotVertex, DotEdge, boost::no_property, boost::listS>*>::clone() const
247
248
        public: // representation
249
250
            ValueType held;
251
252
        private: // intentionally left unimplemented
253
            holder & operator=(const holder &);
254
        };
255
256
    private: // representation
257
        template<typename ValueType>
258
        friend ValueType * unsafe_any_cast(any *) noexcept;
259
260
        friend class boost::anys::unique_any;
261
262
        placeholder * content;
263
        /// @endcond
264
    };
265
266
    /// Exchange of the contents of `lhs` and `rhs`.
267
    /// \throws Nothing.
268
    inline void swap(any & lhs, any & rhs) noexcept
269
0
    {
270
0
        lhs.swap(rhs);
271
0
    }
272
273
    /// @cond
274
275
    // Note: The "unsafe" versions of any_cast are not part of the
276
    // public interface and may be removed at any time. They are
277
    // required where we know what type is stored in the any and can't
278
    // use typeid() comparison, e.g., when our types may travel across
279
    // different shared libraries.
280
    template<typename ValueType>
281
    inline ValueType * unsafe_any_cast(any * operand) noexcept
282
115k
    {
283
115k
        return std::addressof(
284
115k
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
115k
        );
286
115k
    }
unsigned long* boost::unsafe_any_cast<unsigned long>(boost::any*)
Line
Count
Source
282
83.4k
    {
283
83.4k
        return std::addressof(
284
83.4k
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
83.4k
        );
286
83.4k
    }
boost::detail::edge_desc_impl<boost::directed_tag, unsigned long>* boost::unsafe_any_cast<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >(boost::any*)
Line
Count
Source
282
6.17k
    {
283
6.17k
        return std::addressof(
284
6.17k
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
6.17k
        );
286
6.17k
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* boost::unsafe_any_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(boost::any*)
Line
Count
Source
282
10.5k
    {
283
10.5k
        return std::addressof(
284
10.5k
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
10.5k
        );
286
10.5k
    }
int* boost::unsafe_any_cast<int>(boost::any*)
Line
Count
Source
282
680
    {
283
680
        return std::addressof(
284
680
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
680
        );
286
680
    }
float* boost::unsafe_any_cast<float>(boost::any*)
Line
Count
Source
282
818
    {
283
818
        return std::addressof(
284
818
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
818
        );
286
818
    }
double* boost::unsafe_any_cast<double>(boost::any*)
Line
Count
Source
282
115
    {
283
115
        return std::addressof(
284
115
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
115
        );
286
115
    }
bool* boost::unsafe_any_cast<bool>(boost::any*)
Line
Count
Source
282
13.7k
    {
283
13.7k
        return std::addressof(
284
13.7k
            static_cast<any::holder<ValueType> *>(operand->content)->held
285
13.7k
        );
286
13.7k
    }
287
288
    template<typename ValueType>
289
    inline const ValueType * unsafe_any_cast(const any * operand) noexcept
290
    {
291
        return boost::unsafe_any_cast<ValueType>(const_cast<any *>(operand));
292
    }
293
    /// @endcond
294
295
    /// \returns Pointer to a ValueType stored in `operand`, nullptr if
296
    /// `operand` does not contain specified `ValueType`.
297
    template<typename ValueType>
298
    ValueType * any_cast(any * operand) noexcept
299
115k
    {
300
115k
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
115k
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
115k
            : 0;
303
115k
    }
unsigned long* boost::any_cast<unsigned long>(boost::any*)
Line
Count
Source
299
73.2k
    {
300
73.2k
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
73.2k
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
73.2k
            : 0;
303
73.2k
    }
boost::detail::edge_desc_impl<boost::directed_tag, unsigned long>* boost::any_cast<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >(boost::any*)
Line
Count
Source
299
6.17k
    {
300
6.17k
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
6.17k
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
6.17k
            : 0;
303
6.17k
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >* boost::any_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(boost::any*)
Line
Count
Source
299
343
    {
300
343
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
343
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
343
            : 0;
303
343
    }
int* boost::any_cast<int>(boost::any*)
Line
Count
Source
299
680
    {
300
680
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
680
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
680
            : 0;
303
680
    }
float* boost::any_cast<float>(boost::any*)
Line
Count
Source
299
818
    {
300
818
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
818
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
818
            : 0;
303
818
    }
double* boost::any_cast<double>(boost::any*)
Line
Count
Source
299
115
    {
300
115
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
115
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
115
            : 0;
303
115
    }
bool* boost::any_cast<bool>(boost::any*)
Line
Count
Source
299
13.7k
    {
300
13.7k
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
13.7k
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
13.7k
            : 0;
303
13.7k
    }
unsigned long const* boost::any_cast<unsigned long const>(boost::any*)
Line
Count
Source
299
10.2k
    {
300
10.2k
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
10.2k
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
10.2k
            : 0;
303
10.2k
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const* boost::any_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const>(boost::any*)
Line
Count
Source
299
10.2k
    {
300
10.2k
        return operand && operand->type() == boost::typeindex::type_id<ValueType>()
301
10.2k
            ? boost::unsafe_any_cast<typename std::remove_cv<ValueType>::type>(operand)
302
10.2k
            : 0;
303
10.2k
    }
304
305
    /// \returns Const pointer to a ValueType stored in `operand`, nullptr if
306
    /// `operand` does not contain specified `ValueType`.
307
    template<typename ValueType>
308
    inline const ValueType * any_cast(const any * operand) noexcept
309
15.7k
    {
310
15.7k
        return boost::any_cast<ValueType>(const_cast<any *>(operand));
311
15.7k
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const* boost::any_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(boost::any const*)
Line
Count
Source
309
343
    {
310
343
        return boost::any_cast<ValueType>(const_cast<any *>(operand));
311
343
    }
int const* boost::any_cast<int>(boost::any const*)
Line
Count
Source
309
680
    {
310
680
        return boost::any_cast<ValueType>(const_cast<any *>(operand));
311
680
    }
float const* boost::any_cast<float>(boost::any const*)
Line
Count
Source
309
818
    {
310
818
        return boost::any_cast<ValueType>(const_cast<any *>(operand));
311
818
    }
double const* boost::any_cast<double>(boost::any const*)
Line
Count
Source
309
115
    {
310
115
        return boost::any_cast<ValueType>(const_cast<any *>(operand));
311
115
    }
bool const* boost::any_cast<bool>(boost::any const*)
Line
Count
Source
309
13.7k
    {
310
13.7k
        return boost::any_cast<ValueType>(const_cast<any *>(operand));
311
13.7k
    }
312
313
    /// \returns ValueType stored in `operand`
314
    /// \throws boost::bad_any_cast if `operand` does not contain 
315
    /// specified ValueType.
316
    template<typename ValueType>
317
    ValueType any_cast(any & operand)
318
99.8k
    {
319
99.8k
        using nonref = typename std::remove_reference<ValueType>::type;
320
321
99.8k
        nonref * result = boost::any_cast<nonref>(std::addressof(operand));
322
99.8k
        if(!result)
323
0
            boost::throw_exception(bad_any_cast());
324
325
        // Attempt to avoid construction of a temporary object in cases when
326
        // `ValueType` is not a reference. Example:
327
        // `static_cast<std::string>(*result);`
328
        // which is equal to `std::string(*result);`
329
99.8k
        typedef typename std::conditional<
330
99.8k
            std::is_reference<ValueType>::value,
331
99.8k
            ValueType,
332
99.8k
            typename std::add_lvalue_reference<ValueType>::type
333
99.8k
        >::type ref_type;
334
335
#ifdef BOOST_MSVC
336
#   pragma warning(push)
337
#   pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local!
338
#endif
339
99.8k
        return static_cast<ref_type>(*result);
340
#ifdef BOOST_MSVC
341
#   pragma warning(pop)
342
#endif
343
99.8k
    }
unsigned long boost::any_cast<unsigned long>(boost::any&)
Line
Count
Source
318
73.2k
    {
319
73.2k
        using nonref = typename std::remove_reference<ValueType>::type;
320
321
73.2k
        nonref * result = boost::any_cast<nonref>(std::addressof(operand));
322
73.2k
        if(!result)
323
0
            boost::throw_exception(bad_any_cast());
324
325
        // Attempt to avoid construction of a temporary object in cases when
326
        // `ValueType` is not a reference. Example:
327
        // `static_cast<std::string>(*result);`
328
        // which is equal to `std::string(*result);`
329
73.2k
        typedef typename std::conditional<
330
73.2k
            std::is_reference<ValueType>::value,
331
73.2k
            ValueType,
332
73.2k
            typename std::add_lvalue_reference<ValueType>::type
333
73.2k
        >::type ref_type;
334
335
#ifdef BOOST_MSVC
336
#   pragma warning(push)
337
#   pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local!
338
#endif
339
73.2k
        return static_cast<ref_type>(*result);
340
#ifdef BOOST_MSVC
341
#   pragma warning(pop)
342
#endif
343
73.2k
    }
boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> boost::any_cast<boost::detail::edge_desc_impl<boost::directed_tag, unsigned long> >(boost::any&)
Line
Count
Source
318
6.17k
    {
319
6.17k
        using nonref = typename std::remove_reference<ValueType>::type;
320
321
6.17k
        nonref * result = boost::any_cast<nonref>(std::addressof(operand));
322
6.17k
        if(!result)
323
0
            boost::throw_exception(bad_any_cast());
324
325
        // Attempt to avoid construction of a temporary object in cases when
326
        // `ValueType` is not a reference. Example:
327
        // `static_cast<std::string>(*result);`
328
        // which is equal to `std::string(*result);`
329
6.17k
        typedef typename std::conditional<
330
6.17k
            std::is_reference<ValueType>::value,
331
6.17k
            ValueType,
332
6.17k
            typename std::add_lvalue_reference<ValueType>::type
333
6.17k
        >::type ref_type;
334
335
#ifdef BOOST_MSVC
336
#   pragma warning(push)
337
#   pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local!
338
#endif
339
6.17k
        return static_cast<ref_type>(*result);
340
#ifdef BOOST_MSVC
341
#   pragma warning(pop)
342
#endif
343
6.17k
    }
unsigned long const& boost::any_cast<unsigned long const&>(boost::any&)
Line
Count
Source
318
10.2k
    {
319
10.2k
        using nonref = typename std::remove_reference<ValueType>::type;
320
321
10.2k
        nonref * result = boost::any_cast<nonref>(std::addressof(operand));
322
10.2k
        if(!result)
323
0
            boost::throw_exception(bad_any_cast());
324
325
        // Attempt to avoid construction of a temporary object in cases when
326
        // `ValueType` is not a reference. Example:
327
        // `static_cast<std::string>(*result);`
328
        // which is equal to `std::string(*result);`
329
10.2k
        typedef typename std::conditional<
330
10.2k
            std::is_reference<ValueType>::value,
331
10.2k
            ValueType,
332
10.2k
            typename std::add_lvalue_reference<ValueType>::type
333
10.2k
        >::type ref_type;
334
335
#ifdef BOOST_MSVC
336
#   pragma warning(push)
337
#   pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local!
338
#endif
339
10.2k
        return static_cast<ref_type>(*result);
340
#ifdef BOOST_MSVC
341
#   pragma warning(pop)
342
#endif
343
10.2k
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& boost::any_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(boost::any&)
Line
Count
Source
318
10.2k
    {
319
10.2k
        using nonref = typename std::remove_reference<ValueType>::type;
320
321
10.2k
        nonref * result = boost::any_cast<nonref>(std::addressof(operand));
322
10.2k
        if(!result)
323
0
            boost::throw_exception(bad_any_cast());
324
325
        // Attempt to avoid construction of a temporary object in cases when
326
        // `ValueType` is not a reference. Example:
327
        // `static_cast<std::string>(*result);`
328
        // which is equal to `std::string(*result);`
329
10.2k
        typedef typename std::conditional<
330
10.2k
            std::is_reference<ValueType>::value,
331
10.2k
            ValueType,
332
10.2k
            typename std::add_lvalue_reference<ValueType>::type
333
10.2k
        >::type ref_type;
334
335
#ifdef BOOST_MSVC
336
#   pragma warning(push)
337
#   pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local!
338
#endif
339
10.2k
        return static_cast<ref_type>(*result);
340
#ifdef BOOST_MSVC
341
#   pragma warning(pop)
342
#endif
343
10.2k
    }
344
345
    /// \returns `ValueType` stored in `operand`
346
    /// \throws boost::bad_any_cast if `operand` does not contain 
347
    /// specified `ValueType`.
348
    template<typename ValueType>
349
    inline ValueType any_cast(const any & operand)
350
20.4k
    {
351
20.4k
        using nonref = typename std::remove_reference<ValueType>::type;
352
20.4k
        return boost::any_cast<const nonref &>(const_cast<any &>(operand));
353
20.4k
    }
unsigned long boost::any_cast<unsigned long>(boost::any const&)
Line
Count
Source
350
10.2k
    {
351
10.2k
        using nonref = typename std::remove_reference<ValueType>::type;
352
10.2k
        return boost::any_cast<const nonref &>(const_cast<any &>(operand));
353
10.2k
    }
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > boost::any_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(boost::any const&)
Line
Count
Source
350
10.2k
    {
351
10.2k
        using nonref = typename std::remove_reference<ValueType>::type;
352
10.2k
        return boost::any_cast<const nonref &>(const_cast<any &>(operand));
353
10.2k
    }
354
355
    /// \returns `ValueType` stored in `operand`, leaving the `operand` empty.
356
    /// \throws boost::bad_any_cast if `operand` does not contain 
357
    /// specified `ValueType`.
358
    template<typename ValueType>
359
    inline ValueType any_cast(any&& operand)
360
    {
361
        static_assert(
362
            std::is_rvalue_reference<ValueType&&>::value /*true if ValueType is rvalue or just a value*/
363
            || std::is_const< typename std::remove_reference<ValueType>::type >::value,
364
            "boost::any_cast shall not be used for getting nonconst references to temporary objects"
365
        );
366
        return boost::any_cast<ValueType>(operand);
367
    }
368
369
BOOST_ANY_END_MODULE_EXPORT
370
371
}
372
373
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
374
// Copyright Antony Polukhin, 2013-2026.
375
//
376
// Distributed under the Boost Software License, Version 1.0. (See
377
// accompanying file LICENSE_1_0.txt or copy at
378
// http://www.boost.org/LICENSE_1_0.txt)
379
380
#endif  // #if !defined(BOOST_USE_MODULES) || defined(BOOST_ANY_INTERFACE_UNIT)
381
382
#endif