diff --git a/wpilibc/shared/include/Base.h b/wpilibc/shared/include/Base.h index 288d4afaf6..25bea354db 100644 --- a/wpilibc/shared/include/Base.h +++ b/wpilibc/shared/include/Base.h @@ -42,6 +42,16 @@ ClassName(ClassName &&) = default #define DEPRECATED(msg) /*nothing*/ #endif +// Provide std::decay_t when using GCC < 4.9 +#if defined(__GNUC__) + #if __GNUC__ == 4 && __GNUC_MINOR__ < 9 + #include + namespace std { + template using decay_t = typename decay::type; + } + #endif +#endif + // A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer // that is being deleted by someone else. // This should only be called in deprecated functions; using it anywhere else diff --git a/wpilibc/shared/include/Task.h b/wpilibc/shared/include/Task.h index f2de265e34..7752d0dc46 100644 --- a/wpilibc/shared/include/Task.h +++ b/wpilibc/shared/include/Task.h @@ -12,8 +12,6 @@ #include #include -#include - /** * Wrapper class around std::thread that allows changing thread priority */ diff --git a/wpilibc/shared/include/Task.inc b/wpilibc/shared/include/Task.inc index 59b1dfc983..3514b92a45 100644 --- a/wpilibc/shared/include/Task.inc +++ b/wpilibc/shared/include/Task.inc @@ -15,7 +15,8 @@ Task::Task(const std::string& name, Function&& function, Args&&... args) { std::cout << "[HAL] Starting task " << m_taskName << "..." << std::endl; - m_thread = std::thread(function, args...); + m_thread = std::thread(std::forward>(function), + std::forward(args)...); //TODO: lvuser does not currently have permissions to set the priority. //SetPriority(kDefaultPriority);