/src/uWebSockets/src/MoveOnlyFunction.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | MIT License |
3 | | |
4 | | Copyright (c) 2020 Oleg Fatkhiev |
5 | | |
6 | | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | | of this software and associated documentation files (the "Software"), to deal |
8 | | in the Software without restriction, including without limitation the rights |
9 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | | copies of the Software, and to permit persons to whom the Software is |
11 | | furnished to do so, subject to the following conditions: |
12 | | |
13 | | The above copyright notice and this permission notice shall be included in all |
14 | | copies or substantial portions of the Software. |
15 | | |
16 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | | SOFTWARE. |
23 | | */ |
24 | | |
25 | | /* Sources fetched from https://github.com/ofats/any_invocable on 2021-02-19. */ |
26 | | |
27 | | #ifndef _ANY_INVOKABLE_H_ |
28 | | #define _ANY_INVOKABLE_H_ |
29 | | |
30 | | #include <functional> |
31 | | |
32 | | #if !defined(__cpp_lib_move_only_function) || __cpp_lib_move_only_function < 202110L |
33 | | |
34 | | #include <memory> |
35 | | #include <type_traits> |
36 | | |
37 | | // clang-format off |
38 | | /* |
39 | | namespace std { |
40 | | template<class Sig> class any_invocable; // never defined |
41 | | |
42 | | template<class R, class... ArgTypes> |
43 | | class any_invocable<R(ArgTypes...) cv ref noexcept(noex)> { |
44 | | public: |
45 | | using result_type = R; |
46 | | |
47 | | // SECTION.3, construct/copy/destroy |
48 | | any_invocable() noexcept; |
49 | | any_invocable(nullptr_t) noexcept; |
50 | | any_invocable(any_invocable&&) noexcept; |
51 | | template<class F> any_invocable(F&&); |
52 | | |
53 | | template<class T, class... Args> |
54 | | explicit any_invocable(in_place_type_t<T>, Args&&...); |
55 | | template<class T, class U, class... Args> |
56 | | explicit any_invocable(in_place_type_t<T>, initializer_list<U>, Args&&...); |
57 | | |
58 | | any_invocable& operator=(any_invocable&&) noexcept; |
59 | | any_invocable& operator=(nullptr_t) noexcept; |
60 | | template<class F> any_invocable& operator=(F&&); |
61 | | template<class F> any_invocable& operator=(reference_wrapper<F>) noexcept; |
62 | | |
63 | | ~any_invocable(); |
64 | | |
65 | | // SECTION.4, any_invocable modifiers |
66 | | void swap(any_invocable&) noexcept; |
67 | | |
68 | | // SECTION.5, any_invocable capacity |
69 | | explicit operator bool() const noexcept; |
70 | | |
71 | | // SECTION.6, any_invocable invocation |
72 | | R operator()(ArgTypes...) cv ref noexcept(noex); |
73 | | |
74 | | // SECTION.7, null pointer comparisons |
75 | | friend bool operator==(const any_invocable&, nullptr_t) noexcept; |
76 | | |
77 | | // SECTION.8, specialized algorithms |
78 | | friend void swap(any_invocable&, any_invocable&) noexcept; |
79 | | }; |
80 | | } |
81 | | */ |
82 | | // clang-format on |
83 | | |
84 | | namespace ofats { |
85 | | |
86 | | namespace any_detail { |
87 | | |
88 | | using buffer = std::aligned_storage_t<sizeof(void*) * 2, alignof(void*)>; |
89 | | |
90 | | template <class T> |
91 | | inline constexpr bool is_small_object_v = |
92 | | sizeof(T) <= sizeof(buffer) && alignof(buffer) % alignof(T) == 0 && |
93 | | std::is_nothrow_move_constructible_v<T>; |
94 | | |
95 | | union storage { |
96 | | void* ptr_ = nullptr; |
97 | | buffer buf_; |
98 | | }; |
99 | | |
100 | | enum class action { destroy, move }; |
101 | | |
102 | | template <class R, class... ArgTypes> |
103 | | struct handler_traits { |
104 | | template <class Derived> |
105 | | struct handler_base { |
106 | 655k | static void handle(action act, storage* current, storage* other = nullptr) { |
107 | 655k | switch (act) { |
108 | 532k | case (action::destroy): |
109 | 532k | Derived::destroy(*current); |
110 | 532k | break; |
111 | 122k | case (action::move): |
112 | 122k | Derived::move(*current, *other); |
113 | 122k | break; |
114 | 655k | } |
115 | 655k | } ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::handler_base<ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::action) Line | Count | Source | 106 | 224k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 224k | switch (act) { | 108 | 224k | case (action::destroy): | 109 | 224k | Derived::destroy(*current); | 110 | 224k | break; | 111 | 0 | case (action::move): | 112 | 0 | Derived::move(*current, *other); | 113 | 0 | break; | 114 | 224k | } | 115 | 224k | } |
ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::handler_base<ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::action) Line | Count | Source | 106 | 224k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 224k | switch (act) { | 108 | 224k | case (action::destroy): | 109 | 224k | Derived::destroy(*current); | 110 | 224k | break; | 111 | 0 | case (action::move): | 112 | 0 | Derived::move(*current, *other); | 113 | 0 | break; | 114 | 224k | } | 115 | 224k | } |
Unexecuted instantiation: ofats::any_detail::handler_traits<bool, unsigned long>::handler_base<ofats::any_detail::handler_traits<bool, unsigned long>::small_handler<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage) ofats::any_detail::handler_traits<bool, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::handler_base<ofats::any_detail::handler_traits<bool, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::large_handler<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage) Line | Count | Source | 106 | 16.5k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 16.5k | switch (act) { | 108 | 6.61k | case (action::destroy): | 109 | 6.61k | Derived::destroy(*current); | 110 | 6.61k | break; | 111 | 9.92k | case (action::move): | 112 | 9.92k | Derived::move(*current, *other); | 113 | 9.92k | break; | 114 | 16.5k | } | 115 | 16.5k | } |
ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::handler_base<ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage) Line | Count | Source | 106 | 9.92k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 9.92k | switch (act) { | 108 | 3.30k | case (action::destroy): | 109 | 3.30k | Derived::destroy(*current); | 110 | 3.30k | break; | 111 | 6.61k | case (action::move): | 112 | 6.61k | Derived::move(*current, *other); | 113 | 6.61k | break; | 114 | 9.92k | } | 115 | 9.92k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::handler_base<ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<test()::$_0> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage*) Line | Count | Source | 106 | 9.92k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 9.92k | switch (act) { | 108 | 3.30k | case (action::destroy): | 109 | 3.30k | Derived::destroy(*current); | 110 | 3.30k | break; | 111 | 6.61k | case (action::move): | 112 | 6.61k | Derived::move(*current, *other); | 113 | 6.61k | break; | 114 | 9.92k | } | 115 | 9.92k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::handler_base<ofats::any_detail::handler_traits<void>::small_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage) Line | Count | Source | 106 | 91.3k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 91.3k | switch (act) { | 108 | 24.6k | case (action::destroy): | 109 | 24.6k | Derived::destroy(*current); | 110 | 24.6k | break; | 111 | 66.7k | case (action::move): | 112 | 66.7k | Derived::move(*current, *other); | 113 | 66.7k | break; | 114 | 91.3k | } | 115 | 91.3k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::handler_base<ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage) Line | Count | Source | 106 | 57.7k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 57.7k | switch (act) { | 108 | 24.6k | case (action::destroy): | 109 | 24.6k | Derived::destroy(*current); | 110 | 24.6k | break; | 111 | 33.0k | case (action::move): | 112 | 33.0k | Derived::move(*current, *other); | 113 | 33.0k | break; | 114 | 57.7k | } | 115 | 57.7k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::handler_base<ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::action) Line | Count | Source | 106 | 17.3k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 17.3k | switch (act) { | 108 | 17.3k | case (action::destroy): | 109 | 17.3k | Derived::destroy(*current); | 110 | 17.3k | break; | 111 | 0 | case (action::move): | 112 | 0 | Derived::move(*current, *other); | 113 | 0 | break; | 114 | 17.3k | } | 115 | 17.3k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, us_listen_socket_t*>::handler_base<ofats::any_detail::handler_traits<void, us_listen_socket_t*>::small_handler<test()::$_1> >::handle(ofats::any_detail::action, ofats::any_detail::storage*, ofats::any_detail::storage*) Line | Count | Source | 106 | 3.30k | static void handle(action act, storage* current, storage* other = nullptr) { | 107 | 3.30k | switch (act) { | 108 | 3.30k | case (action::destroy): | 109 | 3.30k | Derived::destroy(*current); | 110 | 3.30k | break; | 111 | 0 | case (action::move): | 112 | 0 | Derived::move(*current, *other); | 113 | 0 | break; | 114 | 3.30k | } | 115 | 3.30k | } |
|
116 | | }; |
117 | | |
118 | | template <class T> |
119 | | struct small_handler : handler_base<small_handler<T>> { |
120 | | template <class... Args> |
121 | 563k | static void create(storage& s, Args&&... args) { |
122 | 563k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); |
123 | 563k | } void ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}>::create<{lambda(us_socket_t*, char*, int)#1}>(ofats::any_detail::storage&, {lambda(us_socket_t*, char*, int)#1}&&) Line | Count | Source | 121 | 224k | static void create(storage& s, Args&&... args) { | 122 | 224k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); | 123 | 224k | } |
void ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}>::create<{lambda(us_socket_t*, char*, int)#1}>(ofats::any_detail::storage&, {lambda(us_socket_t*, char*, int)#1}&&) Line | Count | Source | 121 | 224k | static void create(storage& s, Args&&... args) { | 122 | 224k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); | 123 | 224k | } |
Unexecuted instantiation: void ofats::any_detail::handler_traits<bool, unsigned long>::small_handler<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}>::create<{lambda(unsigned long)#1}>(ofats::any_detail::storage&, {lambda(unsigned long)#1}&&) void ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}>::create<{lambda(auto:1*, auto:2*)#1}>(ofats::any_detail::storage&, {lambda(auto:1*, auto:2*)#1}&&) Line | Count | Source | 121 | 9.92k | static void create(storage& s, Args&&... args) { | 122 | 9.92k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); | 123 | 9.92k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<test()::$_0>::create<test()::$_0>(ofats::any_detail::storage&, test()::$_0&&) Line | Count | Source | 121 | 9.92k | static void create(storage& s, Args&&... args) { | 122 | 9.92k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); | 123 | 9.92k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::handler_traits<void>::small_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}>::create<{lambda()#1}>(ofats::any_detail::storage&, {lambda()#1}&&) Line | Count | Source | 121 | 91.3k | static void create(storage& s, Args&&... args) { | 122 | 91.3k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); | 123 | 91.3k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::handler_traits<void, us_listen_socket_t*>::small_handler<test()::$_1>::create<test()::$_1>(ofats::any_detail::storage&, test()::$_1&&) Line | Count | Source | 121 | 3.30k | static void create(storage& s, Args&&... args) { | 122 | 3.30k | new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...); | 123 | 3.30k | } |
|
124 | | |
125 | 563k | static void destroy(storage& s) noexcept { |
126 | 563k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); |
127 | 563k | value.~T(); |
128 | 563k | } ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 125 | 224k | static void destroy(storage& s) noexcept { | 126 | 224k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); | 127 | 224k | value.~T(); | 128 | 224k | } |
ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 125 | 224k | static void destroy(storage& s) noexcept { | 126 | 224k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); | 127 | 224k | value.~T(); | 128 | 224k | } |
Unexecuted instantiation: ofats::any_detail::handler_traits<bool, unsigned long>::small_handler<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}>::destroy(ofats::any_detail::storage&) ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 125 | 9.92k | static void destroy(storage& s) noexcept { | 126 | 9.92k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); | 127 | 9.92k | value.~T(); | 128 | 9.92k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<test()::$_0>::destroy(ofats::any_detail::storage&) Line | Count | Source | 125 | 9.92k | static void destroy(storage& s) noexcept { | 126 | 9.92k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); | 127 | 9.92k | value.~T(); | 128 | 9.92k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::small_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 125 | 91.3k | static void destroy(storage& s) noexcept { | 126 | 91.3k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); | 127 | 91.3k | value.~T(); | 128 | 91.3k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, us_listen_socket_t*>::small_handler<test()::$_1>::destroy(ofats::any_detail::storage&) Line | Count | Source | 125 | 3.30k | static void destroy(storage& s) noexcept { | 126 | 3.30k | T& value = *static_cast<T*>(static_cast<void*>(&s.buf_)); | 127 | 3.30k | value.~T(); | 128 | 3.30k | } |
|
129 | | |
130 | 79.9k | static void move(storage& dst, storage& src) noexcept { |
131 | 79.9k | create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_)))); |
132 | 79.9k | destroy(src); |
133 | 79.9k | } Unexecuted instantiation: ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}>::move(ofats::any_detail::storage&, ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}>) Unexecuted instantiation: ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}>::move(ofats::any_detail::storage&, ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}>) Unexecuted instantiation: ofats::any_detail::handler_traits<bool, unsigned long>::small_handler<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}>::move(ofats::any_detail::storage&, ofats::any_detail::storage) ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}>::move(ofats::any_detail::storage&, ofats::any_detail::storage) Line | Count | Source | 130 | 6.61k | static void move(storage& dst, storage& src) noexcept { | 131 | 6.61k | create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_)))); | 132 | 6.61k | destroy(src); | 133 | 6.61k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<test()::$_0>::move(ofats::any_detail::storage&, ofats::any_detail::storage&) Line | Count | Source | 130 | 6.61k | static void move(storage& dst, storage& src) noexcept { | 131 | 6.61k | create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_)))); | 132 | 6.61k | destroy(src); | 133 | 6.61k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::small_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}>::move(ofats::any_detail::storage&, ofats::any_detail::storage) Line | Count | Source | 130 | 66.7k | static void move(storage& dst, storage& src) noexcept { | 131 | 66.7k | create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_)))); | 132 | 66.7k | destroy(src); | 133 | 66.7k | } |
Unexecuted instantiation: AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, us_listen_socket_t*>::small_handler<test()::$_1>::move(ofats::any_detail::storage&, ofats::any_detail::storage&) |
134 | | |
135 | 229k | static R call(storage& s, ArgTypes... args) { |
136 | 229k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), |
137 | 229k | std::forward<ArgTypes>(args)...); |
138 | 229k | } ofats::any_detail::handler_traits<void*, void*, uWS::HttpRequest*>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}>::call(ofats::any_detail::storage&, void*, uWS::HttpRequest*) Line | Count | Source | 135 | 73.4k | static R call(storage& s, ArgTypes... args) { | 136 | 73.4k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), | 137 | 73.4k | std::forward<ArgTypes>(args)...); | 138 | 73.4k | } |
ofats::any_detail::handler_traits<void*, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::small_handler<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}>::call(ofats::any_detail::storage&, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool) Line | Count | Source | 135 | 73.2k | static R call(storage& s, ArgTypes... args) { | 136 | 73.2k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), | 137 | 73.2k | std::forward<ArgTypes>(args)...); | 138 | 73.2k | } |
Unexecuted instantiation: ofats::any_detail::handler_traits<bool, unsigned long>::small_handler<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}>::call(ofats::any_detail::storage&, unsigned long) ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}>::call(ofats::any_detail::storage&, uWS::HttpResponse<false>*, uWS::HttpRequest*) Line | Count | Source | 135 | 47.8k | static R call(storage& s, ArgTypes... args) { | 136 | 47.8k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), | 137 | 47.8k | std::forward<ArgTypes>(args)...); | 138 | 47.8k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, uWS::HttpResponse<false>*, uWS::HttpRequest*>::small_handler<test()::$_0>::call(ofats::any_detail::storage&, uWS::HttpResponse<false>*, uWS::HttpRequest*) Line | Count | Source | 135 | 24.6k | static R call(storage& s, ArgTypes... args) { | 136 | 24.6k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), | 137 | 24.6k | std::forward<ArgTypes>(args)...); | 138 | 24.6k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::small_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}>::call(ofats::any_detail::storage&) Line | Count | Source | 135 | 7.27k | static R call(storage& s, ArgTypes... args) { | 136 | 7.27k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), | 137 | 7.27k | std::forward<ArgTypes>(args)...); | 138 | 7.27k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void, us_listen_socket_t*>::small_handler<test()::$_1>::call(ofats::any_detail::storage&, us_listen_socket_t*) Line | Count | Source | 135 | 3.30k | static R call(storage& s, ArgTypes... args) { | 136 | 3.30k | return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)), | 137 | 3.30k | std::forward<ArgTypes>(args)...); | 138 | 3.30k | } |
|
139 | | }; |
140 | | |
141 | | template <class T> |
142 | | struct large_handler : handler_base<large_handler<T>> { |
143 | | template <class... Args> |
144 | 48.6k | static void create(storage& s, Args&&... args) { |
145 | 48.6k | s.ptr_ = new T(std::forward<Args>(args)...); |
146 | 48.6k | } void ofats::any_detail::handler_traits<bool, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::large_handler<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}>::create<{lambda(auto:1*)#1}>(ofats::any_detail::storage&, {lambda(auto:1*)#1}&&) Line | Count | Source | 144 | 6.61k | static void create(storage& s, Args&&... args) { | 145 | 6.61k | s.ptr_ = new T(std::forward<Args>(args)...); | 146 | 6.61k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}>::create<{lambda()#2}>(ofats::any_detail::storage&, {lambda()#2}&&) Line | Count | Source | 144 | 24.6k | static void create(storage& s, Args&&... args) { | 145 | 24.6k | s.ptr_ = new T(std::forward<Args>(args)...); | 146 | 24.6k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}>::create<{lambda()#2}>(ofats::any_detail::storage&, {lambda()#2}&&) Line | Count | Source | 144 | 17.3k | static void create(storage& s, Args&&... args) { | 145 | 17.3k | s.ptr_ = new T(std::forward<Args>(args)...); | 146 | 17.3k | } |
|
147 | | |
148 | 48.6k | static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); } ofats::any_detail::handler_traits<bool, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::large_handler<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 148 | 6.61k | static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 148 | 24.6k | static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}>::destroy(ofats::any_detail::storage&) Line | Count | Source | 148 | 17.3k | static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); } |
|
149 | | |
150 | 42.9k | static void move(storage& dst, storage& src) noexcept { |
151 | 42.9k | dst.ptr_ = src.ptr_; |
152 | 42.9k | } ofats::any_detail::handler_traits<bool, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::large_handler<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}>::move(ofats::any_detail::storage&, ofats::any_detail::storage) Line | Count | Source | 150 | 9.92k | static void move(storage& dst, storage& src) noexcept { | 151 | 9.92k | dst.ptr_ = src.ptr_; | 152 | 9.92k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}>::move(ofats::any_detail::storage&, ofats::any_detail::storage) Line | Count | Source | 150 | 33.0k | static void move(storage& dst, storage& src) noexcept { | 151 | 33.0k | dst.ptr_ = src.ptr_; | 152 | 33.0k | } |
Unexecuted instantiation: AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}>::move(ofats::any_detail::storage&, ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}>) |
153 | | |
154 | 112k | static R call(storage& s, ArgTypes... args) { |
155 | 112k | return std::invoke(*static_cast<T*>(s.ptr_), |
156 | 112k | std::forward<ArgTypes>(args)...); |
157 | 112k | } ofats::any_detail::handler_traits<bool, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::large_handler<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}>::call(ofats::any_detail::storage&, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*) Line | Count | Source | 154 | 72.4k | static R call(storage& s, ArgTypes... args) { | 155 | 72.4k | return std::invoke(*static_cast<T*>(s.ptr_), | 156 | 72.4k | std::forward<ArgTypes>(args)...); | 157 | 72.4k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}>::call(ofats::any_detail::storage&) Line | Count | Source | 154 | 22.9k | static R call(storage& s, ArgTypes... args) { | 155 | 22.9k | return std::invoke(*static_cast<T*>(s.ptr_), | 156 | 22.9k | std::forward<ArgTypes>(args)...); | 157 | 22.9k | } |
AsyncEpollHelloWorld.cpp:ofats::any_detail::handler_traits<void>::large_handler<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}>::call(ofats::any_detail::storage&) Line | Count | Source | 154 | 17.3k | static R call(storage& s, ArgTypes... args) { | 155 | 17.3k | return std::invoke(*static_cast<T*>(s.ptr_), | 156 | 17.3k | std::forward<ArgTypes>(args)...); | 157 | 17.3k | } |
|
158 | | }; |
159 | | |
160 | | template <class T> |
161 | | using handler = std::conditional_t<is_small_object_v<T>, small_handler<T>, |
162 | | large_handler<T>>; |
163 | | }; |
164 | | |
165 | | template <class T> |
166 | | struct is_in_place_type : std::false_type {}; |
167 | | |
168 | | template <class T> |
169 | | struct is_in_place_type<std::in_place_type_t<T>> : std::true_type {}; |
170 | | |
171 | | template <class T> |
172 | | inline constexpr auto is_in_place_type_v = is_in_place_type<T>::value; |
173 | | |
174 | | template <class R, bool is_noexcept, class... ArgTypes> |
175 | | class any_invocable_impl { |
176 | | template <class T> |
177 | | using handler = |
178 | | typename any_detail::handler_traits<R, ArgTypes...>::template handler<T>; |
179 | | |
180 | | using storage = any_detail::storage; |
181 | | using action = any_detail::action; |
182 | | using handle_func = void (*)(any_detail::action, any_detail::storage*, |
183 | | any_detail::storage*); |
184 | | using call_func = R (*)(any_detail::storage&, ArgTypes...); |
185 | | |
186 | | public: |
187 | | using result_type = R; |
188 | | |
189 | 3.17M | any_invocable_impl() noexcept = default; ofats::any_detail::any_invocable_impl<void, false, char const*>::any_invocable_impl() Line | Count | Source | 189 | 3.30k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::any_invocable_impl() Line | Count | Source | 189 | 878k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<void, false>::any_invocable_impl() Line | Count | Source | 189 | 945k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::any_invocable_impl() Line | Count | Source | 189 | 878k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<void*, false, void*, uWS::HttpRequest*>::any_invocable_impl() Line | Count | Source | 189 | 224k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<void*, false, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::any_invocable_impl() Line | Count | Source | 189 | 224k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::any_invocable_impl() Line | Count | Source | 189 | 6.61k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::any_invocable_impl() Line | Count | Source | 189 | 6.61k | any_invocable_impl() noexcept = default; |
ofats::any_detail::any_invocable_impl<void, false, us_listen_socket_t*>::any_invocable_impl() Line | Count | Source | 189 | 3.30k | any_invocable_impl() noexcept = default; |
|
190 | 130k | any_invocable_impl(std::nullptr_t) noexcept {} Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::any_invocable_impl(decltype(nullptr)) ofats::any_detail::any_invocable_impl<void, false>::any_invocable_impl(decltype(nullptr)) Line | Count | Source | 190 | 65.2k | any_invocable_impl(std::nullptr_t) noexcept {} |
ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::any_invocable_impl(decltype(nullptr)) Line | Count | Source | 190 | 65.2k | any_invocable_impl(std::nullptr_t) noexcept {} |
|
191 | 80.8k | any_invocable_impl(any_invocable_impl&& rhs) noexcept { |
192 | 80.8k | if (rhs.handle_) { |
193 | 80.8k | handle_ = rhs.handle_; |
194 | 80.8k | handle_(action::move, &storage_, &rhs.storage_); |
195 | 80.8k | call_ = rhs.call_; |
196 | 80.8k | rhs.handle_ = nullptr; |
197 | 80.8k | } |
198 | 80.8k | } Unexecuted instantiation: ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::any_invocable_impl(ofats::any_detail::any_invocable_impl<bool, false, unsigned long>&&) ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::any_invocable_impl(ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>&&) Line | Count | Source | 191 | 9.92k | any_invocable_impl(any_invocable_impl&& rhs) noexcept { | 192 | 9.92k | if (rhs.handle_) { | 193 | 9.92k | handle_ = rhs.handle_; | 194 | 9.92k | handle_(action::move, &storage_, &rhs.storage_); | 195 | 9.92k | call_ = rhs.call_; | 196 | 9.92k | rhs.handle_ = nullptr; | 197 | 9.92k | } | 198 | 9.92k | } |
ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::any_invocable_impl(ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>&&) Line | Count | Source | 191 | 13.2k | any_invocable_impl(any_invocable_impl&& rhs) noexcept { | 192 | 13.2k | if (rhs.handle_) { | 193 | 13.2k | handle_ = rhs.handle_; | 194 | 13.2k | handle_(action::move, &storage_, &rhs.storage_); | 195 | 13.2k | call_ = rhs.call_; | 196 | 13.2k | rhs.handle_ = nullptr; | 197 | 13.2k | } | 198 | 13.2k | } |
ofats::any_detail::any_invocable_impl<void, false>::any_invocable_impl(ofats::any_detail::any_invocable_impl<void, false>&&) Line | Count | Source | 191 | 57.7k | any_invocable_impl(any_invocable_impl&& rhs) noexcept { | 192 | 57.7k | if (rhs.handle_) { | 193 | 57.7k | handle_ = rhs.handle_; | 194 | 57.7k | handle_(action::move, &storage_, &rhs.storage_); | 195 | 57.7k | call_ = rhs.call_; | 196 | 57.7k | rhs.handle_ = nullptr; | 197 | 57.7k | } | 198 | 57.7k | } |
|
199 | | |
200 | 24.6k | any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept { |
201 | 24.6k | any_invocable_impl{std::move(rhs)}.swap(*this); |
202 | 24.6k | return *this; |
203 | 24.6k | } Unexecuted instantiation: ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::operator=(ofats::any_detail::any_invocable_impl<bool, false, unsigned long>&&) Unexecuted instantiation: ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::operator=(ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>&&) ofats::any_detail::any_invocable_impl<void, false>::operator=(ofats::any_detail::any_invocable_impl<void, false>&&) Line | Count | Source | 200 | 24.6k | any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept { | 201 | 24.6k | any_invocable_impl{std::move(rhs)}.swap(*this); | 202 | 24.6k | return *this; | 203 | 24.6k | } |
|
204 | | any_invocable_impl& operator=(std::nullptr_t) noexcept { |
205 | | destroy(); |
206 | | return *this; |
207 | | } |
208 | | |
209 | 3.38M | ~any_invocable_impl() { destroy(); } ofats::any_detail::any_invocable_impl<void, false, us_listen_socket_t*>::~any_invocable_impl() Line | Count | Source | 209 | 3.30k | ~any_invocable_impl() { destroy(); } |
ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::~any_invocable_impl() Line | Count | Source | 209 | 19.8k | ~any_invocable_impl() { destroy(); } |
ofats::any_detail::any_invocable_impl<void, false>::~any_invocable_impl() Line | Count | Source | 209 | 1.06M | ~any_invocable_impl() { destroy(); } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, uWS::Loop*>::~any_invocable_impl() ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::~any_invocable_impl() Line | Count | Source | 209 | 16.5k | ~any_invocable_impl() { destroy(); } |
ofats::any_detail::any_invocable_impl<void, false, char const*>::~any_invocable_impl() Line | Count | Source | 209 | 3.30k | ~any_invocable_impl() { destroy(); } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, int>::~any_invocable_impl() ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::~any_invocable_impl() Line | Count | Source | 209 | 878k | ~any_invocable_impl() { destroy(); } |
ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::~any_invocable_impl() Line | Count | Source | 209 | 943k | ~any_invocable_impl() { destroy(); } |
ofats::any_detail::any_invocable_impl<void*, false, void*, uWS::HttpRequest*>::~any_invocable_impl() Line | Count | Source | 209 | 224k | ~any_invocable_impl() { destroy(); } |
ofats::any_detail::any_invocable_impl<void*, false, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::~any_invocable_impl() Line | Count | Source | 209 | 224k | ~any_invocable_impl() { destroy(); } |
|
210 | | |
211 | 179k | void swap(any_invocable_impl& rhs) noexcept { |
212 | 179k | if (handle_) { |
213 | 24.6k | if (rhs.handle_) { |
214 | 0 | storage tmp; |
215 | 0 | handle_(action::move, &tmp, &storage_); |
216 | 0 | rhs.handle_(action::move, &storage_, &rhs.storage_); |
217 | 0 | handle_(action::move, &rhs.storage_, &tmp); |
218 | 0 | std::swap(handle_, rhs.handle_); |
219 | 0 | std::swap(call_, rhs.call_); |
220 | 24.6k | } else { |
221 | 24.6k | rhs.swap(*this); |
222 | 24.6k | } |
223 | 155k | } else if (rhs.handle_) { |
224 | 42.0k | rhs.handle_(action::move, &storage_, &rhs.storage_); |
225 | 42.0k | handle_ = rhs.handle_; |
226 | 42.0k | call_ = rhs.call_; |
227 | 42.0k | rhs.handle_ = nullptr; |
228 | 42.0k | } |
229 | 179k | } Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::swap(ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>&) ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::swap(ofats::any_detail::any_invocable_impl<bool, false, unsigned long>&) Line | Count | Source | 211 | 65.2k | void swap(any_invocable_impl& rhs) noexcept { | 212 | 65.2k | if (handle_) { | 213 | 0 | if (rhs.handle_) { | 214 | 0 | storage tmp; | 215 | 0 | handle_(action::move, &tmp, &storage_); | 216 | 0 | rhs.handle_(action::move, &storage_, &rhs.storage_); | 217 | 0 | handle_(action::move, &rhs.storage_, &tmp); | 218 | 0 | std::swap(handle_, rhs.handle_); | 219 | 0 | std::swap(call_, rhs.call_); | 220 | 0 | } else { | 221 | 0 | rhs.swap(*this); | 222 | 0 | } | 223 | 65.2k | } else if (rhs.handle_) { | 224 | 0 | rhs.handle_(action::move, &storage_, &rhs.storage_); | 225 | 0 | handle_ = rhs.handle_; | 226 | 0 | call_ = rhs.call_; | 227 | 0 | rhs.handle_ = nullptr; | 228 | 0 | } | 229 | 65.2k | } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::swap(ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>&) ofats::any_detail::any_invocable_impl<void, false>::swap(ofats::any_detail::any_invocable_impl<void, false>&) Line | Count | Source | 211 | 114k | void swap(any_invocable_impl& rhs) noexcept { | 212 | 114k | if (handle_) { | 213 | 24.6k | if (rhs.handle_) { | 214 | 0 | storage tmp; | 215 | 0 | handle_(action::move, &tmp, &storage_); | 216 | 0 | rhs.handle_(action::move, &storage_, &rhs.storage_); | 217 | 0 | handle_(action::move, &rhs.storage_, &tmp); | 218 | 0 | std::swap(handle_, rhs.handle_); | 219 | 0 | std::swap(call_, rhs.call_); | 220 | 24.6k | } else { | 221 | 24.6k | rhs.swap(*this); | 222 | 24.6k | } | 223 | 89.8k | } else if (rhs.handle_) { | 224 | 42.0k | rhs.handle_(action::move, &storage_, &rhs.storage_); | 225 | 42.0k | handle_ = rhs.handle_; | 226 | 42.0k | call_ = rhs.call_; | 227 | 42.0k | rhs.handle_ = nullptr; | 228 | 42.0k | } | 229 | 114k | } |
|
230 | | |
231 | 1.01M | explicit operator bool() const noexcept { return handle_ != nullptr; } ofats::any_detail::any_invocable_impl<void, false>::operator bool() const Line | Count | Source | 231 | 903k | explicit operator bool() const noexcept { return handle_ != nullptr; } |
ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::operator bool() const Line | Count | Source | 231 | 97.8k | explicit operator bool() const noexcept { return handle_ != nullptr; } |
ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::operator bool() const Line | Count | Source | 231 | 11.2k | explicit operator bool() const noexcept { return handle_ != nullptr; } |
ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::operator bool() const Line | Count | Source | 231 | 6.61k | explicit operator bool() const noexcept { return handle_ != nullptr; } |
|
232 | | |
233 | | protected: |
234 | | template <class F, class... Args> |
235 | 532k | void create(Args&&... args) { |
236 | 532k | using hdl = handler<F>; |
237 | 532k | hdl::create(storage_, std::forward<Args>(args)...); |
238 | 532k | handle_ = &hdl::handle; |
239 | 532k | call_ = &hdl::call; |
240 | 532k | } void ofats::any_detail::any_invocable_impl<void*, false, void*, uWS::HttpRequest*>::create<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}, {lambda(us_socket_t*, char*, int)#1}>({lambda(us_socket_t*, char*, int)#1}&&) Line | Count | Source | 235 | 224k | void create(Args&&... args) { | 236 | 224k | using hdl = handler<F>; | 237 | 224k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 224k | handle_ = &hdl::handle; | 239 | 224k | call_ = &hdl::call; | 240 | 224k | } |
void ofats::any_detail::any_invocable_impl<void*, false, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::create<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}, {lambda(us_socket_t*, char*, int)#1}>({lambda(us_socket_t*, char*, int)#1}&&) Line | Count | Source | 235 | 224k | void create(Args&&... args) { | 236 | 224k | using hdl = handler<F>; | 237 | 224k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 224k | handle_ = &hdl::handle; | 239 | 224k | call_ = &hdl::call; | 240 | 224k | } |
Unexecuted instantiation: void ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::create<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}, {lambda(unsigned long)#1}>({lambda(unsigned long)#1}&&) void ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::create<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}, {lambda(auto:1*)#1}>({lambda(auto:1*)#1}&&) Line | Count | Source | 235 | 6.61k | void create(Args&&... args) { | 236 | 6.61k | using hdl = handler<F>; | 237 | 6.61k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 6.61k | handle_ = &hdl::handle; | 239 | 6.61k | call_ = &hdl::call; | 240 | 6.61k | } |
void ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::create<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}, {lambda(auto:1*, auto:2*)#1}>({lambda(auto:1*, auto:2*)#1}&&) Line | Count | Source | 235 | 3.30k | void create(Args&&... args) { | 236 | 3.30k | using hdl = handler<F>; | 237 | 3.30k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 3.30k | handle_ = &hdl::handle; | 239 | 3.30k | call_ = &hdl::call; | 240 | 3.30k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::create<test()::$_0, test()::$_0>(test()::$_0&&) Line | Count | Source | 235 | 3.30k | void create(Args&&... args) { | 236 | 3.30k | using hdl = handler<F>; | 237 | 3.30k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 3.30k | handle_ = &hdl::handle; | 239 | 3.30k | call_ = &hdl::call; | 240 | 3.30k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::any_invocable_impl<void, false>::create<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}, {lambda()#1}>({lambda()#1}&&) Line | Count | Source | 235 | 24.6k | void create(Args&&... args) { | 236 | 24.6k | using hdl = handler<F>; | 237 | 24.6k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 24.6k | handle_ = &hdl::handle; | 239 | 24.6k | call_ = &hdl::call; | 240 | 24.6k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::any_invocable_impl<void, false>::create<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}, {lambda()#2}>({lambda()#2}&&) Line | Count | Source | 235 | 24.6k | void create(Args&&... args) { | 236 | 24.6k | using hdl = handler<F>; | 237 | 24.6k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 24.6k | handle_ = &hdl::handle; | 239 | 24.6k | call_ = &hdl::call; | 240 | 24.6k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::any_invocable_impl<void, false>::create<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}, {lambda()#2}>({lambda()#2}&&) Line | Count | Source | 235 | 17.3k | void create(Args&&... args) { | 236 | 17.3k | using hdl = handler<F>; | 237 | 17.3k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 17.3k | handle_ = &hdl::handle; | 239 | 17.3k | call_ = &hdl::call; | 240 | 17.3k | } |
AsyncEpollHelloWorld.cpp:void ofats::any_detail::any_invocable_impl<void, false, us_listen_socket_t*>::create<test()::$_1, test()::$_1>(test()::$_1&&) Line | Count | Source | 235 | 3.30k | void create(Args&&... args) { | 236 | 3.30k | using hdl = handler<F>; | 237 | 3.30k | hdl::create(storage_, std::forward<Args>(args)...); | 238 | 3.30k | handle_ = &hdl::handle; | 239 | 3.30k | call_ = &hdl::call; | 240 | 3.30k | } |
|
241 | | |
242 | 3.38M | void destroy() noexcept { |
243 | 3.38M | if (handle_) { |
244 | 532k | handle_(action::destroy, &storage_, nullptr); |
245 | 532k | handle_ = nullptr; |
246 | 532k | } |
247 | 3.38M | } ofats::any_detail::any_invocable_impl<void, false, us_listen_socket_t*>::destroy() Line | Count | Source | 242 | 3.30k | void destroy() noexcept { | 243 | 3.30k | if (handle_) { | 244 | 3.30k | handle_(action::destroy, &storage_, nullptr); | 245 | 3.30k | handle_ = nullptr; | 246 | 3.30k | } | 247 | 3.30k | } |
ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::destroy() Line | Count | Source | 242 | 19.8k | void destroy() noexcept { | 243 | 19.8k | if (handle_) { | 244 | 6.61k | handle_(action::destroy, &storage_, nullptr); | 245 | 6.61k | handle_ = nullptr; | 246 | 6.61k | } | 247 | 19.8k | } |
ofats::any_detail::any_invocable_impl<void, false>::destroy() Line | Count | Source | 242 | 1.06M | void destroy() noexcept { | 243 | 1.06M | if (handle_) { | 244 | 66.7k | handle_(action::destroy, &storage_, nullptr); | 245 | 66.7k | handle_ = nullptr; | 246 | 66.7k | } | 247 | 1.06M | } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, uWS::Loop*>::destroy() ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::destroy() Line | Count | Source | 242 | 16.5k | void destroy() noexcept { | 243 | 16.5k | if (handle_) { | 244 | 6.61k | handle_(action::destroy, &storage_, nullptr); | 245 | 6.61k | handle_ = nullptr; | 246 | 6.61k | } | 247 | 16.5k | } |
ofats::any_detail::any_invocable_impl<void, false, char const*>::destroy() Line | Count | Source | 242 | 3.30k | void destroy() noexcept { | 243 | 3.30k | if (handle_) { | 244 | 0 | handle_(action::destroy, &storage_, nullptr); | 245 | 0 | handle_ = nullptr; | 246 | 0 | } | 247 | 3.30k | } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, int>::destroy() ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::destroy() Line | Count | Source | 242 | 878k | void destroy() noexcept { | 243 | 878k | if (handle_) { | 244 | 0 | handle_(action::destroy, &storage_, nullptr); | 245 | 0 | handle_ = nullptr; | 246 | 0 | } | 247 | 878k | } |
ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::destroy() Line | Count | Source | 242 | 943k | void destroy() noexcept { | 243 | 943k | if (handle_) { | 244 | 0 | handle_(action::destroy, &storage_, nullptr); | 245 | 0 | handle_ = nullptr; | 246 | 0 | } | 247 | 943k | } |
ofats::any_detail::any_invocable_impl<void*, false, void*, uWS::HttpRequest*>::destroy() Line | Count | Source | 242 | 224k | void destroy() noexcept { | 243 | 224k | if (handle_) { | 244 | 224k | handle_(action::destroy, &storage_, nullptr); | 245 | 224k | handle_ = nullptr; | 246 | 224k | } | 247 | 224k | } |
ofats::any_detail::any_invocable_impl<void*, false, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::destroy() Line | Count | Source | 242 | 224k | void destroy() noexcept { | 243 | 224k | if (handle_) { | 244 | 224k | handle_(action::destroy, &storage_, nullptr); | 245 | 224k | handle_ = nullptr; | 246 | 224k | } | 247 | 224k | } |
|
248 | | |
249 | 342k | R call(ArgTypes... args) noexcept(is_noexcept) { |
250 | 342k | return call_(storage_, std::forward<ArgTypes>(args)...); |
251 | 342k | } ofats::any_detail::any_invocable_impl<void, false>::call() Line | Count | Source | 249 | 47.5k | R call(ArgTypes... args) noexcept(is_noexcept) { | 250 | 47.5k | return call_(storage_, std::forward<ArgTypes>(args)...); | 251 | 47.5k | } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, uWS::Loop*>::call(uWS::Loop*) Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, int>::call(uWS::HttpResponse<false>*, int) ofats::any_detail::any_invocable_impl<void*, false, void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::call(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool) Line | Count | Source | 249 | 73.2k | R call(ArgTypes... args) noexcept(is_noexcept) { | 250 | 73.2k | return call_(storage_, std::forward<ArgTypes>(args)...); | 251 | 73.2k | } |
ofats::any_detail::any_invocable_impl<void*, false, void*, uWS::HttpRequest*>::call(void*, uWS::HttpRequest*) Line | Count | Source | 249 | 73.4k | R call(ArgTypes... args) noexcept(is_noexcept) { | 250 | 73.4k | return call_(storage_, std::forward<ArgTypes>(args)...); | 251 | 73.4k | } |
ofats::any_detail::any_invocable_impl<bool, false, uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*>::call(uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*) Line | Count | Source | 249 | 72.4k | R call(ArgTypes... args) noexcept(is_noexcept) { | 250 | 72.4k | return call_(storage_, std::forward<ArgTypes>(args)...); | 251 | 72.4k | } |
Unexecuted instantiation: ofats::any_detail::any_invocable_impl<void, false, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool>::call(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool) Unexecuted instantiation: ofats::any_detail::any_invocable_impl<bool, false, unsigned long>::call(unsigned long) ofats::any_detail::any_invocable_impl<void, false, uWS::HttpResponse<false>*, uWS::HttpRequest*>::call(uWS::HttpResponse<false>*, uWS::HttpRequest*) Line | Count | Source | 249 | 72.4k | R call(ArgTypes... args) noexcept(is_noexcept) { | 250 | 72.4k | return call_(storage_, std::forward<ArgTypes>(args)...); | 251 | 72.4k | } |
ofats::any_detail::any_invocable_impl<void, false, us_listen_socket_t*>::call(us_listen_socket_t*) Line | Count | Source | 249 | 3.30k | R call(ArgTypes... args) noexcept(is_noexcept) { | 250 | 3.30k | return call_(storage_, std::forward<ArgTypes>(args)...); | 251 | 3.30k | } |
|
252 | | |
253 | | friend bool operator==(const any_invocable_impl& f, std::nullptr_t) noexcept { |
254 | | return !f; |
255 | | } |
256 | | friend bool operator==(std::nullptr_t, const any_invocable_impl& f) noexcept { |
257 | | return !f; |
258 | | } |
259 | | friend bool operator!=(const any_invocable_impl& f, std::nullptr_t) noexcept { |
260 | | return static_cast<bool>(f); |
261 | | } |
262 | | friend bool operator!=(std::nullptr_t, const any_invocable_impl& f) noexcept { |
263 | | return static_cast<bool>(f); |
264 | | } |
265 | | |
266 | | friend void swap(any_invocable_impl& lhs, any_invocable_impl& rhs) noexcept { |
267 | | lhs.swap(rhs); |
268 | | } |
269 | | |
270 | | private: |
271 | | storage storage_; |
272 | | handle_func handle_ = nullptr; |
273 | | call_func call_; |
274 | | }; |
275 | | |
276 | | template <class T> |
277 | | using remove_cvref_t = std::remove_cv_t<std::remove_reference_t<T>>; |
278 | | |
279 | | template <class AI, class F, bool noex, class R, class FCall, class... ArgTypes> |
280 | | using can_convert = std::conjunction< |
281 | | std::negation<std::is_same<remove_cvref_t<F>, AI>>, |
282 | | std::negation<any_detail::is_in_place_type<remove_cvref_t<F>>>, |
283 | | std::is_invocable_r<R, FCall, ArgTypes...>, |
284 | | std::bool_constant<(!noex || |
285 | | std::is_nothrow_invocable_r_v<R, FCall, ArgTypes...>)>, |
286 | | std::is_constructible<std::decay_t<F>, F>>; |
287 | | |
288 | | } // namespace any_detail |
289 | | |
290 | | template <class Signature> |
291 | | class any_invocable; |
292 | | |
293 | | #define __OFATS_ANY_INVOCABLE(cv, ref, noex, inv_quals) \ |
294 | | template <class R, class... ArgTypes> \ |
295 | | class any_invocable<R(ArgTypes...) cv ref noexcept(noex)> \ |
296 | | : public any_detail::any_invocable_impl<R, noex, ArgTypes...> { \ |
297 | | using base_type = any_detail::any_invocable_impl<R, noex, ArgTypes...>; \ |
298 | | \ |
299 | | public: \ |
300 | | using base_type::base_type; \ |
301 | | \ |
302 | | template < \ |
303 | | class F, \ |
304 | | class = std::enable_if_t<any_detail::can_convert< \ |
305 | | any_invocable, F, noex, R, F inv_quals, ArgTypes...>::value>> \ |
306 | 532k | any_invocable(F&& f) { \ |
307 | 532k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ |
308 | 532k | } \ ofats::any_invocable<void* (void*, uWS::HttpRequest*)>::any_invocable<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}, void>(uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, uWS::HttpRequest*)#1}&&) Line | Count | Source | 306 | 224k | any_invocable(F&& f) { \ | 307 | 224k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 224k | } \ |
ofats::any_invocable<void* (void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)>::any_invocable<uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}, void>(uWS::HttpContext<false>::init()::{lambda(us_socket_t*, char*, int)#1}::operator()(us_socket_t*, char*, int) const::{lambda(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)#1}&&) Line | Count | Source | 306 | 224k | any_invocable(F&& f) { \ | 307 | 224k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 224k | } \ |
Unexecuted instantiation: ofats::any_invocable<bool (unsigned long)>::any_invocable<uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}, void>(uWS::HttpResponseData<false>::callOnWritable(unsigned long)::{lambda(unsigned long)#1}&&) ofats::any_invocable<bool (uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*)>::any_invocable<uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}, void>(uWS::HttpContext<false>::onHttp(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> >, ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>&&, bool)::{lambda(auto:1*)#1}&&) Line | Count | Source | 306 | 6.61k | any_invocable(F&& f) { \ | 307 | 6.61k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 6.61k | } \ |
ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>::any_invocable<uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}, void>(uWS::TemplatedApp<false>::TemplatedApp(uWS::SocketContextOptions)::{lambda(auto:1*, auto:2*)#1}&&) Line | Count | Source | 306 | 3.30k | any_invocable(F&& f) { \ | 307 | 3.30k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 3.30k | } \ |
AsyncEpollHelloWorld.cpp:ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>::any_invocable<test()::$_0, void>(test()::$_0&&) Line | Count | Source | 306 | 3.30k | any_invocable(F&& f) { \ | 307 | 3.30k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 3.30k | } \ |
AsyncEpollHelloWorld.cpp:ofats::any_invocable<void ()>::any_invocable<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}, void>(test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#1}&&) Line | Count | Source | 306 | 24.6k | any_invocable(F&& f) { \ | 307 | 24.6k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 24.6k | } \ |
AsyncEpollHelloWorld.cpp:ofats::any_invocable<void ()>::any_invocable<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}, void>(test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}&&) Line | Count | Source | 306 | 24.6k | any_invocable(F&& f) { \ | 307 | 24.6k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 24.6k | } \ |
AsyncEpollHelloWorld.cpp:ofats::any_invocable<void ()>::any_invocable<test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}, void>(test()::$_0::operator()<uWS::HttpResponse<false>, uWS::HttpRequest>(uWS::HttpResponse<false>*, uWS::HttpRequest*) const::{lambda()#2}::operator()() const::{lambda()#1}&&) Line | Count | Source | 306 | 17.3k | any_invocable(F&& f) { \ | 307 | 17.3k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 17.3k | } \ |
AsyncEpollHelloWorld.cpp:ofats::any_invocable<void (us_listen_socket_t*)>::any_invocable<test()::$_1, void>(test()::$_1&&) Line | Count | Source | 306 | 3.30k | any_invocable(F&& f) { \ | 307 | 3.30k | base_type::template create<std::decay_t<F>>(std::forward<F>(f)); \ | 308 | 3.30k | } \ |
|
309 | | \ |
310 | | template <class T, class... Args, class VT = std::decay_t<T>, \ |
311 | | class = std::enable_if_t< \ |
312 | | std::is_move_constructible_v<VT> && \ |
313 | | std::is_constructible_v<VT, Args...> && \ |
314 | | std::is_invocable_r_v<R, VT inv_quals, ArgTypes...> && \ |
315 | | (!noex || std::is_nothrow_invocable_r_v<R, VT inv_quals, \ |
316 | | ArgTypes...>)>> \ |
317 | | explicit any_invocable(std::in_place_type_t<T>, Args&&... args) { \ |
318 | | base_type::template create<VT>(std::forward<Args>(args)...); \ |
319 | | } \ |
320 | | \ |
321 | | template < \ |
322 | | class T, class U, class... Args, class VT = std::decay_t<T>, \ |
323 | | class = std::enable_if_t< \ |
324 | | std::is_move_constructible_v<VT> && \ |
325 | | std::is_constructible_v<VT, std::initializer_list<U>&, Args...> && \ |
326 | | std::is_invocable_r_v<R, VT inv_quals, ArgTypes...> && \ |
327 | | (!noex || \ |
328 | | std::is_nothrow_invocable_r_v<R, VT inv_quals, ArgTypes...>)>> \ |
329 | | explicit any_invocable(std::in_place_type_t<T>, \ |
330 | | std::initializer_list<U> il, Args&&... args) { \ |
331 | | base_type::template create<VT>(il, std::forward<Args>(args)...); \ |
332 | | } \ |
333 | | \ |
334 | | template <class F, class FDec = std::decay_t<F>> \ |
335 | | std::enable_if_t<!std::is_same_v<FDec, any_invocable> && \ |
336 | | std::is_move_constructible_v<FDec>, \ |
337 | | any_invocable&> \ |
338 | 130k | operator=(F&& f) { \ |
339 | 130k | any_invocable{std::forward<F>(f)}.swap(*this); \ |
340 | 130k | return *this; \ |
341 | 130k | } \ Unexecuted instantiation: _ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEaSIDnDnEENS1_9enable_ifIXaantsr3stdE9is_same_vIT0_S7_Esr3stdE23is_move_constructible_vISA_EERS7_E4typeEOT_ Unexecuted instantiation: _ZN5ofats13any_invocableIFbmEEaSIZN3uWS16HttpResponseDataILb0EE14callOnWritableEmEUlmE_S7_EENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vISA_EERS2_E4typeEOT_ _ZN5ofats13any_invocableIFvvEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_ Line | Count | Source | 338 | 65.2k | operator=(F&& f) { \ | 339 | 65.2k | any_invocable{std::forward<F>(f)}.swap(*this); \ | 340 | 65.2k | return *this; \ | 341 | 65.2k | } \ |
_ZN5ofats13any_invocableIFbmEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_ Line | Count | Source | 338 | 65.2k | operator=(F&& f) { \ | 339 | 65.2k | any_invocable{std::forward<F>(f)}.swap(*this); \ | 340 | 65.2k | return *this; \ | 341 | 65.2k | } \ |
|
342 | | template <class F> \ |
343 | | any_invocable& operator=(std::reference_wrapper<F> f) { \ |
344 | | any_invocable{f}.swap(*this); \ |
345 | | return *this; \ |
346 | | } \ |
347 | | \ |
348 | 342k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ |
349 | 342k | return base_type::call(std::forward<ArgTypes>(args)...); \ |
350 | 342k | } \ ofats::any_invocable<void ()>::operator()() Line | Count | Source | 348 | 47.5k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ | 349 | 47.5k | return base_type::call(std::forward<ArgTypes>(args)...); \ | 350 | 47.5k | } \ |
Unexecuted instantiation: ofats::any_invocable<void (uWS::Loop*)>::operator()(uWS::Loop*) Unexecuted instantiation: ofats::any_invocable<void (uWS::HttpResponse<false>*, int)>::operator()(uWS::HttpResponse<false>*, int) ofats::any_invocable<void* (void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)>::operator()(void*, std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool) Line | Count | Source | 348 | 73.2k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ | 349 | 73.2k | return base_type::call(std::forward<ArgTypes>(args)...); \ | 350 | 73.2k | } \ |
ofats::any_invocable<void* (void*, uWS::HttpRequest*)>::operator()(void*, uWS::HttpRequest*) Line | Count | Source | 348 | 73.4k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ | 349 | 73.4k | return base_type::call(std::forward<ArgTypes>(args)...); \ | 350 | 73.4k | } \ |
ofats::any_invocable<bool (uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*)>::operator()(uWS::HttpRouter<uWS::HttpContextData<false>::RouterData>*) Line | Count | Source | 348 | 72.4k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ | 349 | 72.4k | return base_type::call(std::forward<ArgTypes>(args)...); \ | 350 | 72.4k | } \ |
Unexecuted instantiation: ofats::any_invocable<void (std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool)>::operator()(std::__1::basic_string_view<char, std::__1::char_traits<char> >, bool) Unexecuted instantiation: ofats::any_invocable<bool (unsigned long)>::operator()(unsigned long) ofats::any_invocable<void (uWS::HttpResponse<false>*, uWS::HttpRequest*)>::operator()(uWS::HttpResponse<false>*, uWS::HttpRequest*) Line | Count | Source | 348 | 72.4k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ | 349 | 72.4k | return base_type::call(std::forward<ArgTypes>(args)...); \ | 350 | 72.4k | } \ |
ofats::any_invocable<void (us_listen_socket_t*)>::operator()(us_listen_socket_t*) Line | Count | Source | 348 | 3.30k | R operator()(ArgTypes... args) cv ref noexcept(noex) { \ | 349 | 3.30k | return base_type::call(std::forward<ArgTypes>(args)...); \ | 350 | 3.30k | } \ |
|
351 | | }; |
352 | | |
353 | | // cv -> {`empty`, const} |
354 | | // ref -> {`empty`, &, &&} |
355 | | // noex -> {true, false} |
356 | | // inv_quals -> (is_empty(ref) ? & : ref) |
357 | | __OFATS_ANY_INVOCABLE(, , false, &) // 000 |
358 | | __OFATS_ANY_INVOCABLE(, , true, &) // 001 |
359 | | __OFATS_ANY_INVOCABLE(, &, false, &) // 010 |
360 | | __OFATS_ANY_INVOCABLE(, &, true, &) // 011 |
361 | | __OFATS_ANY_INVOCABLE(, &&, false, &&) // 020 |
362 | | __OFATS_ANY_INVOCABLE(, &&, true, &&) // 021 |
363 | | __OFATS_ANY_INVOCABLE(const, , false, const&) // 100 |
364 | | __OFATS_ANY_INVOCABLE(const, , true, const&) // 101 |
365 | | __OFATS_ANY_INVOCABLE(const, &, false, const&) // 110 |
366 | | __OFATS_ANY_INVOCABLE(const, &, true, const&) // 111 |
367 | | __OFATS_ANY_INVOCABLE(const, &&, false, const&&) // 120 |
368 | | __OFATS_ANY_INVOCABLE(const, &&, true, const&&) // 121 |
369 | | |
370 | | #undef __OFATS_ANY_INVOCABLE |
371 | | |
372 | | } // namespace ofats |
373 | | |
374 | | /* We, uWebSockets define our own type */ |
375 | | namespace uWS { |
376 | | template <class T> |
377 | | using MoveOnlyFunction = ofats::any_invocable<T>; |
378 | | } |
379 | | |
380 | | #else // !defined(__cpp_lib_move_only_function) || __cpp_lib_move_only_function < 202110L |
381 | | |
382 | | namespace uWS { |
383 | | template <class T> |
384 | | using MoveOnlyFunction = std::move_only_function<T>; |
385 | | } |
386 | | |
387 | | #endif |
388 | | |
389 | | #endif // _ANY_INVOKABLE_H_ |