summaryrefslogtreecommitdiff
path: root/include/mbgl/actor
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-08-08 10:42:44 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-08-08 11:36:30 +0300
commit68f470fdda4e31d7704fba3e41bb2f899db39541 (patch)
tree439153bc9a62a5ed46d335cb8f6b9020d146a1f1 /include/mbgl/actor
parent2dd8ec885453b6c75d982dd90722e583b2da3525 (diff)
downloadqtlocation-mapboxgl-68f470fdda4e31d7704fba3e41bb2f899db39541.tar.gz
[core] make actor self reference optional - again
- uses a different method of constructor selection that also works on Apple clang < 8.2.
Diffstat (limited to 'include/mbgl/actor')
-rw-r--r--include/mbgl/actor/actor.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/mbgl/actor/actor.hpp b/include/mbgl/actor/actor.hpp
index 6610421eb5..a0df19208e 100644
--- a/include/mbgl/actor/actor.hpp
+++ b/include/mbgl/actor/actor.hpp
@@ -50,13 +50,18 @@ class Actor : public util::noncopyable {
public:
// Enabled for Objects with a constructor taking ActorRef<Object> as the first parameter
- template <typename U = Object, class... Args,
- typename std::enable_if<std::is_constructible<U, ActorRef<Object>, Args...>::value>::type...>
+ template <typename U = Object, class... Args, typename std::enable_if<std::is_constructible<U, ActorRef<U>, Args...>::value>::type * = nullptr>
Actor(Scheduler& scheduler, Args&&... args_)
: mailbox(std::make_shared<Mailbox>(scheduler)),
object(self(), std::forward<Args>(args_)...) {
}
+ // Enabled for plain Objects
+ template<typename U = Object, class... Args, typename std::enable_if<!std::is_constructible<U, ActorRef<U>, Args...>::value>::type * = nullptr>
+ Actor(Scheduler& scheduler, Args&& ... args_)
+ : mailbox(std::make_shared<Mailbox>(scheduler)), object(std::forward<Args>(args_)...) {
+ }
+
~Actor() {
mailbox->close();
}