• Clemens Hammacher's avatar
    [handles] Use is_convertible instead of is_base_of · f8072dbd
    Clemens Hammacher authored
    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: 's avatarLeszek Swirski <leszeks@chromium.org>
    Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#49440}
    f8072dbd
handles.h 14.4 KB