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

Add some convenience operators to observable #994

Merged
merged 7 commits into from
Sep 29, 2016
Merged

Conversation

codemercenary
Copy link
Contributor

@codemercenary codemercenary commented Sep 15, 2016

These seem like they would be used frequently enough for an observable type, especially the comparison operators which are critical to the

@jdonald update: It seems we need only the hash function.

These seem like they would be used frequently enough for an observable type, especially the comparison operators which are critical to the
auto operator/(const T& rhs) -> decltype(val * rhs) { return val / rhs; }
auto operator+(const T& rhs) -> decltype(val * rhs) { return val + rhs; }
auto operator-(const T& rhs) -> decltype(val * rhs) { return val - rhs; }
};
Copy link
Contributor

Choose a reason for hiding this comment

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

These operators don't seem to be hit at all via the unit test. I mean, I can remove them and the test still compiles and runs.

I suspect it's because operator const T&(void) const { return val; } already does everything we need.

Still investigating.

@@ -100,3 +99,16 @@ struct marshaller<observable<T>> :
};

}

namespace std {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice addition, this will be handy

@yeswalrus yeswalrus merged commit 42bfbea into master Sep 29, 2016
@yeswalrus yeswalrus deleted the feature-observableops branch September 29, 2016 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants