File tree Expand file tree Collapse file tree 3 files changed +49
-4
lines changed Expand file tree Collapse file tree 3 files changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ find_package(Threads)
56
56
57
57
# Common configuration for all build modes.
58
58
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
59
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter" )
59
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Werror -Woverloaded-virtual " )
60
60
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -momit-leaf-frame-pointer" )
61
61
62
62
# Configuration for Debug build mode.
@@ -289,4 +289,18 @@ target_link_libraries(
289
289
290
290
add_dependencies (tcpresumeserver gmock )
291
291
292
+ add_executable (
293
+ subscriber_non_payload
294
+ test /simple/SubscriberNonPayloadTest.cpp
295
+ )
296
+
297
+ target_link_libraries (
298
+ subscriber_non_payload
299
+ ReactiveSocket
300
+ ${FOLLY_LIBRARIES}
301
+ ${CMAKE_THREAD_LIBS_INIT}
302
+ )
303
+
304
+ add_dependencies (subscriber_non_payload ReactiveSocket ReactiveStreams )
305
+
292
306
# EOF
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ namespace reactivesocket {
30
30
// / implicitly specified as virtual, depending on whether the Base class
31
31
// / is implementing the (virtual) methods of the
32
32
// / Subscription or the Subscriber interface.
33
- template <typename Base>
33
+ template <typename Base, typename Payload = Payload >
34
34
class MemoryMixin : public Base {
35
35
static_assert (
36
36
std::is_base_of<IntrusiveDeleter, Base>::value,
@@ -126,10 +126,11 @@ class WithIntrusiveDeleter {
126
126
127
127
} // namespace details
128
128
129
- template <typename Base, typename ... TArgs>
129
+ template <typename Base, typename Payload = Payload, typename ... TArgs>
130
130
Base& createManagedInstance (TArgs&&... args) {
131
131
auto * instance =
132
- new MemoryMixin<typename details::WithIntrusiveDeleter<Base>::T>(
132
+ new MemoryMixin<typename details::WithIntrusiveDeleter<Base>::T,
133
+ Payload>(
133
134
std::forward<TArgs>(args)...);
134
135
return *instance;
135
136
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2004-present Facebook. All Rights Reserved.
2
+
3
+ #include < stddef.h>
4
+
5
+ #include " src/ReactiveStreamsCompat.h"
6
+ #include " src/Payload.h"
7
+ #include " src/mixins/IntrusiveDeleter.h"
8
+ #include " src/mixins/MemoryMixin.h"
9
+
10
+ using namespace reactivesocket ;
11
+
12
+ class Foo {
13
+ public:
14
+ explicit Foo (const std::string&) {}
15
+ };
16
+
17
+ class FooSubscriber : public IntrusiveDeleter , public Subscriber <Foo> {
18
+ public:
19
+ ~FooSubscriber () override = default ;
20
+ void onSubscribe (Subscription&) override {}
21
+ void onNext (Foo) override {}
22
+ void onComplete () override {}
23
+ void onError (folly::exception_wrapper) override {}
24
+ };
25
+
26
+ int main (int argc, char ** argv) {
27
+ auto & m = createManagedInstance<FooSubscriber, Foo>();
28
+ m.onNext (Foo (" asdf" ));
29
+ return 0 ;
30
+ }
You can’t perform that action at this time.
0 commit comments