| Index: compiled/subscription/Subscription.h |
| =================================================================== |
| --- a/compiled/subscription/Subscription.h |
| +++ b/compiled/subscription/Subscription.h |
| @@ -94,13 +94,30 @@ public: |
| Filter* BINDINGS_EXPORTED FilterAt(Filters::size_type index); |
| int BINDINGS_EXPORTED IndexOfFilter(const Filter& filter); |
| OwnedString BINDINGS_EXPORTED Serialize() const; |
| OwnedString BINDINGS_EXPORTED SerializeFilters() const; |
| static Subscription* BINDINGS_EXPORTED FromID(const String& id); |
| - template<typename T> |
| - T* As(); |
| + template<typename T, |
| + typename std::enable_if<std::is_base_of<Subscription, T>::value>::type* = nullptr> |
|
sergei
2017/10/13 12:34:36
static_cast does not allow down casting at a compi
Wladimir Palant
2017/10/13 16:58:18
You are correct, removed.
|
| + T* As() |
| + { |
| + if (mType != T::classType) |
| + return nullptr; |
| + |
| + return static_cast<T*>(this); |
|
sergei
2017/10/13 12:34:36
In addition, since T::classType seems already a co
Wladimir Palant
2017/10/13 16:58:18
Note that we have different checks for Filter and
|
| + } |
| + |
| + template<typename T, |
| + typename std::enable_if<std::is_base_of<Subscription, T>::value>::type* = nullptr> |
| + const T* As() const |
| + { |
| + if (mType != T::classType) |
| + return nullptr; |
| + |
| + return static_cast<const T*>(this); |
| + } |
| }; |
| typedef intrusive_ptr<Subscription> SubscriptionPtr; |