We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please consider this example:
// 1: This compiles rxcpp::connectable_observable<int> connectable; rxcpp::observable<int> o = connectable; // 2: This doesn't rxcpp::connectable_observable<int> *connectable_ptr; rxcpp::observable<int> *ptr = connectable_ptr;
Since connectable_observable derives from observable, why does (1) compile, and (2) doesn't?
connectable_observable
observable
The text was updated successfully, but these errors were encountered:
Yes, connectable_observable<> does inherit from observable<>
connectable_observable<>
observable<>
template<class T, class SourceOperator> class connectable_observable : public observable<T, SourceOperator>
The devil is in the type-forgetting of the SourceOperator.
SourceOperator
template< class T = void, class SourceObservable = typename std::conditional<std::is_same<T, void>::value, void, dynamic_observable<T>>::type> class observable; template<class T, class SourceObservable = typename std::conditional<std::is_same<T, void>::value, void, dynamic_connectable_observable<T>>::type> class connectable_observable;
So connectable_observable<int> is actually
connectable_observable<int>
class connectable_observable<int, dynamic_connectable_observable<int>> : public observable<int, dynamic_connectable_observable<int>>
which does not convert to observable<int, dynamic_observable<int>>
observable<int, dynamic_observable<int>>
This is surprising behavior and we should think about how to make the type-forgetting work with this cast to the base.
Thanks for the report!
Sorry, something went wrong.
No branches or pull requests
Please consider this example:
Since
connectable_observable
derives fromobservable
, why does (1) compile, and (2) doesn't?The text was updated successfully, but these errors were encountered: