[handles] Use is_convertible instead of is_base_of
std::is_base_of<A, B> has undefined behaviour if B is not a complete type. Hence, avoid it and use is_convertible<B*, A*> instead. This captures exactly the requirement that Handle<A> foo() { return produce<Handle<B>>(); } is valid exactly if A* foo() { return produce<B>(); } is valid. Also, change some static asserts to enable_ifs in order to allow overloading a function by different Handle types, which would cause disambiguity otherwise. R=tebbi@chromium.org Change-Id: I60fbdfcfd96c7b216e42819a5b5de3423a2c38d0 Reviewed-on: https://chromium-review.googlesource.com/774841Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#49440}
Showing
Please
register
or
sign in
to comment