Fix hardcoded string in propertyChangedTo
Prior to this change this template will not build with types
other than strings.
Add an example that tests this.
Change-Id: I71e5c4136e7e4fd52fea3e8e027e42634011d630
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/events.hpp b/events.hpp
index 0c789bd..65eb06a 100644
--- a/events.hpp
+++ b/events.hpp
@@ -140,7 +140,8 @@
return false;
}
- return _condition(it->second.template get<T>());
+ return _condition(
+ std::forward<T>(it->second.template get<T>()));
}
private:
@@ -157,9 +158,9 @@
auto propertyChangedTo(
const char* iface,
const char* property,
- T val)
+ T&& val)
{
- auto condition = [val = std::move(val)](const std::string & arg)
+ auto condition = [val = std::move(val)](T && arg)
{
return arg == val;
};