Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operators: Add ref_count(other) operator overload. #485

Merged
merged 1 commit into from Mar 6, 2019

Conversation

iam
Copy link
Contributor

@iam iam commented Feb 15, 2019

The existing connectable_observable.ref_count() operator calls
connect on the source when it's subscribed to.

Generalize this by allowing an optional parameter other, i.e.
observable.ref_count(connectable_observable other) to be used as the
connect target.

Useful for implementing diamond graphs while retaining composability:

     A
   /   \
  B     C
   \   /
     D
     |
     E

auto A = ... | publish();
auto B = A | ...;
auto C = A | ...;
auto D = B | merge(C) | ref_count(A);
auto E = D | ...;

E | subscribe(...);

Resolves: #484

Copy link
Member

@kirkshoop kirkshoop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you! If you need help with the tests I am happy to work with you on them.

The existing `connectable_observable.ref_count()` operator calls
connect on the source when it's subscribed to.

Generalize this by allowing an optional parameter `other`, i.e.
`observable.ref_count(connectable_observable other)` to be used as the
connect target.

Useful for implementing diamond graphs while retaining composability:

```
     A
   /   \
  B     C
   \   /
     D
     |
     E

auto A = ... | publish();
auto B = A | ...;
auto C = A | ...;
auto D = B | merge(C) | ref_count(A);
auto E = D | ...;

E | subscribe(...);
```

Resolves: ReactiveX#484
@kirkshoop kirkshoop merged commit 8eddaa1 into ReactiveX:master Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants