Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    f134eace
    DRTVWR-558: LLEventAPI allows all LLEventDispatcher add() overloads. · f134eace
    Nat Goodspeed authored
    Previously, LLEventAPI intentionally hid all but one of the many add()
    overloads supported by its LLEventDispatcher base class. The reason was that
    certain of the add() methods take an optional fourth parameter that's an
    LLSD::Map describing the expected parameter structure, while others take a
    fourth templated parameter that's an instance getter callable. This led to
    ambiguity, especially when passed an LLSDMap instance that's convertible to
    LLSD but isn't literally LLSD. At the time, it was simpler to constrain the
    add() methods inherited from LLEventDispatcher.
    
    But by adding new std::enable_if constraints to certain LLEventDispatcher
    add() methods, we've resolved the ambiguities, so LLEventAPI subclasses can
    now use any add() overload (as claimed on the relevant Confluence page).
    
    LLEventDispatcher comments have always loftily claimed that an instance getter
    callable may return either a pointer or a reference, doesn't matter. But it
    does when trying to pass the getter's result to boost::fusion::push_back(): a
    reference must be wrapped with std::ref() while a pointer cannot be.
    std::ref(pointer) produces errors. Introduce LLEventDispatcher::invoker::
    bindable() overloads to Do The Right Thing whether passed a pointer or a
    reference.
    
    (cherry picked from commit 743f487c2e123171c9fc6d5b84d768f1d856d569)
    f134eace
    History
    DRTVWR-558: LLEventAPI allows all LLEventDispatcher add() overloads.
    Nat Goodspeed authored
    Previously, LLEventAPI intentionally hid all but one of the many add()
    overloads supported by its LLEventDispatcher base class. The reason was that
    certain of the add() methods take an optional fourth parameter that's an
    LLSD::Map describing the expected parameter structure, while others take a
    fourth templated parameter that's an instance getter callable. This led to
    ambiguity, especially when passed an LLSDMap instance that's convertible to
    LLSD but isn't literally LLSD. At the time, it was simpler to constrain the
    add() methods inherited from LLEventDispatcher.
    
    But by adding new std::enable_if constraints to certain LLEventDispatcher
    add() methods, we've resolved the ambiguities, so LLEventAPI subclasses can
    now use any add() overload (as claimed on the relevant Confluence page).
    
    LLEventDispatcher comments have always loftily claimed that an instance getter
    callable may return either a pointer or a reference, doesn't matter. But it
    does when trying to pass the getter's result to boost::fusion::push_back(): a
    reference must be wrapped with std::ref() while a pointer cannot be.
    std::ref(pointer) produces errors. Introduce LLEventDispatcher::invoker::
    bindable() overloads to Do The Right Thing whether passed a pointer or a
    reference.
    
    (cherry picked from commit 743f487c2e123171c9fc6d5b84d768f1d856d569)
Code owners
Assign users and groups as approvers for specific file changes. Learn more.