1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

gcc-4.5 fix (kinda)

actually it was more of a bug in the code, but it worked in gcc-4.4
This commit is contained in:
Pavel Labath 2010-08-21 18:01:16 +02:00
parent 4cb6606ea2
commit da5d739fd9

View File

@ -98,11 +98,11 @@ namespace conky {
template<typename T> template<typename T>
class register_data_source { class register_data_source {
template<typename... Args> template<typename... Args>
static int factory(lua::state *l, const std::string &name, Args&&... args) static int factory(lua::state *l, const std::string &name, const Args&... args)
{ {
T *t = static_cast<T *>(l->newuserdata(sizeof(T))); T *t = static_cast<T *>(l->newuserdata(sizeof(T)));
l->insert(1); l->insert(1);
new(t) T(l, name, std::forward<Args>(args)...); new(t) T(l, name, args...);
l->settop(1); l->settop(1);
l->rawgetfield(lua::REGISTRYINDEX, priv::data_source_metatable); l->rawgetfield(lua::REGISTRYINDEX, priv::data_source_metatable);
l->setmetatable(-2); l->setmetatable(-2);
@ -114,9 +114,7 @@ namespace conky {
register_data_source(const std::string &name, Args&&... args) register_data_source(const std::string &name, Args&&... args)
{ {
priv::do_register_data_source( name, std::bind(&factory<Args...>, priv::do_register_data_source( name, std::bind(&factory<Args...>,
std::placeholders::_1, std::placeholders::_1, name, args...
name,
std::forward<Args>(args)...
)); ));
} }
}; };