FOR_EACH_OBSERVER does not support dependent types |
|||
Issue description
template <typename T>
struct Observer {
public:
void OnEvent();
};
template <typename T>
class Bar {
public:
void Event() {
FOR_EACH_OBSERVER(Observer<T>, observer_list_, OnEvent());
}
private:
base::ObserverList<Observer<T>> observer_list_;
};
The above code fails to compile since the FOR_EACH_OBSERVER macro expansion cannot figure out the type of base::ObserevrListBase<ObserverType> since it is a dependent type.
,
Jul 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/89b89baef6868ee3c23c0c68f100179fb03f7217 commit 89b89baef6868ee3c23c0c68f100179fb03f7217 Author: lhchavez <lhchavez@chromium.org> Date: Wed Jul 13 03:47:47 2016 Add support for dependent types in FOR_EACH_OBSERVER In the expansion of FOR_EACH_OBSERVER, there is a base::ObserverListBase<ObserverType>::Iterator. If ObserverType is a templated type, it won't compile due to a lack of a 'typename'. This change fixes that. BUG= 627209 TEST=dependent types now compile Review-Url: https://codereview.chromium.org/2137183003 Cr-Commit-Position: refs/heads/master@{#404980} [modify] https://crrev.com/89b89baef6868ee3c23c0c68f100179fb03f7217/base/observer_list.h
,
Jul 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/05b7d4f124a608289ff685341c146cb7e38f1fd6 commit 05b7d4f124a608289ff685341c146cb7e38f1fd6 Author: lhchavez <lhchavez@chromium.org> Date: Wed Jul 13 16:13:56 2016 arc: Use FOR_EACH_OBSERVER in InstanceHolder Now that FOR_EACH_OBSERVER supports dependent types, we can use it instead of its expansion. BUG= 627209 TEST=trybots Review-Url: https://codereview.chromium.org/2147443005 Cr-Commit-Position: refs/heads/master@{#405174} [modify] https://crrev.com/05b7d4f124a608289ff685341c146cb7e38f1fd6/components/arc/instance_holder.h
,
Jul 13 2016
,
Jul 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/89b89baef6868ee3c23c0c68f100179fb03f7217 commit 89b89baef6868ee3c23c0c68f100179fb03f7217 Author: lhchavez <lhchavez@chromium.org> Date: Wed Jul 13 03:47:47 2016 Add support for dependent types in FOR_EACH_OBSERVER In the expansion of FOR_EACH_OBSERVER, there is a base::ObserverListBase<ObserverType>::Iterator. If ObserverType is a templated type, it won't compile due to a lack of a 'typename'. This change fixes that. BUG= 627209 TEST=dependent types now compile Review-Url: https://codereview.chromium.org/2137183003 Cr-Commit-Position: refs/heads/master@{#404980} [modify] https://crrev.com/89b89baef6868ee3c23c0c68f100179fb03f7217/base/observer_list.h
,
Jul 13 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/05b7d4f124a608289ff685341c146cb7e38f1fd6 commit 05b7d4f124a608289ff685341c146cb7e38f1fd6 Author: lhchavez <lhchavez@chromium.org> Date: Wed Jul 13 16:13:56 2016 arc: Use FOR_EACH_OBSERVER in InstanceHolder Now that FOR_EACH_OBSERVER supports dependent types, we can use it instead of its expansion. BUG= 627209 TEST=trybots Review-Url: https://codereview.chromium.org/2147443005 Cr-Commit-Position: refs/heads/master@{#405174} [modify] https://crrev.com/05b7d4f124a608289ff685341c146cb7e38f1fd6/components/arc/instance_holder.h |
|||
►
Sign in to add a comment |
|||
Comment 1 by lhchavez@chromium.org
, Jul 12 2016