Dedulicate make_unique
This also gets us off of the WPILib one which goes away for 2019.
Change-Id: I0436ce8fd477bbb27d9b0a7c4832dad01c9bad35
diff --git a/y2018/BUILD b/y2018/BUILD
index 6173702..2a510a9 100644
--- a/y2018/BUILD
+++ b/y2018/BUILD
@@ -70,6 +70,7 @@
deps = [
":status_light",
"//aos:init",
+ "//aos:make_unique",
"//aos:math",
"//aos/controls:control_loop",
"//aos/logging",
diff --git a/y2018/wpilib_interface.cc b/y2018/wpilib_interface.cc
index 0493bb5..dea6a7b 100644
--- a/y2018/wpilib_interface.cc
+++ b/y2018/wpilib_interface.cc
@@ -22,8 +22,10 @@
#undef ERROR
#include "aos/commonmath.h"
+#include "aos/init.h"
#include "aos/logging/logging.h"
#include "aos/logging/queue_logging.h"
+#include "aos/make_unique.h"
#include "aos/robot_state/robot_state.q.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
@@ -31,7 +33,6 @@
#include "aos/util/log_interval.h"
#include "aos/util/phased_loop.h"
#include "aos/util/wrapping_counter.h"
-#include "aos/init.h"
#include "frc971/autonomous/auto.q.h"
#include "frc971/control_loops/control_loops.q.h"
@@ -63,6 +64,7 @@
using ::y2018::constants::Values;
using ::aos::monotonic_clock;
namespace chrono = ::std::chrono;
+using aos::make_unique;
namespace y2018 {
namespace wpilib {
@@ -74,17 +76,8 @@
// DMA stuff and then removing the * 2.0 in *_translate.
// The low bit is direction.
-// TODO(brian): Replace this with ::std::make_unique once all our toolchains
-// have support.
-
-template <class T, class... U>
-std::unique_ptr<T> make_unique(U &&... u) {
- return std::unique_ptr<T>(new T(std::forward<U>(u)...));
-}
-
// TODO(brian): Use ::std::max instead once we have C++14 so that can be
// constexpr.
-
template <typename T>
constexpr T max(T a, T b) {
return (a > b) ? a : b;