Dedulicate make_unique

This also gets us off of the WPILib one which goes away for 2019.

Change-Id: I0436ce8fd477bbb27d9b0a7c4832dad01c9bad35
diff --git a/aos/BUILD b/aos/BUILD
index fca0258..2bd5791 100644
--- a/aos/BUILD
+++ b/aos/BUILD
@@ -401,3 +401,11 @@
         "//aos/util:run_command",
     ],
 )
+
+cc_library(
+    name = "make_unique",
+    hdrs = [
+        "make_unique.h",
+    ],
+    visibility = ["//visibility:public"],
+)
diff --git a/aos/make_unique.h b/aos/make_unique.h
new file mode 100644
index 0000000..8031f45
--- /dev/null
+++ b/aos/make_unique.h
@@ -0,0 +1,44 @@
+#ifndef AOS_MAKE_UNIQUE_H_
+#define AOS_MAKE_UNIQUE_H_
+
+// TODO(brian): Replace this file with ::std::make_unique once all our
+// toolchains have support.
+
+namespace aos {
+
+/// Constructs a `new T()` with the given args and returns a
+///        `unique_ptr<T>` which owns the object.
+///
+/// Example:
+///
+///     auto p = make_unique<int>();
+///     auto p = make_unique<std::tuple<int, int>>(0, 1);
+template <class T, class... Args>
+typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
+make_unique(Args &&... args) {
+  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+
+/// Constructs a `new T[n]` with the given args and returns a
+///        `unique_ptr<T[]>` which owns the object.
+///
+/// \param n size of the new array.
+///
+/// Example:
+///
+///     auto p = make_unique<int[]>(2); // value-initializes the array with 0's.
+template <class T>
+typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0,
+                        std::unique_ptr<T>>::type
+make_unique(size_t n) {
+  return std::unique_ptr<T>(new typename std::remove_extent<T>::type[n]());
+}
+
+/// This function isn't used and is only here to provide better compile errors.
+template <class T, class... Args>
+typename std::enable_if<std::extent<T>::value != 0>::type
+make_unique(Args &&...) = delete;
+
+}  // namespace aos
+
+#endif  // AOS_MAKE_UNIQUE_H_
diff --git a/frc971/wpilib/ahal/BUILD b/frc971/wpilib/ahal/BUILD
index f643f57..f91b3fa 100644
--- a/frc971/wpilib/ahal/BUILD
+++ b/frc971/wpilib/ahal/BUILD
@@ -18,6 +18,7 @@
     restricted_to = ["//tools:roborio"],
     visibility = ["//third_party:__pkg__"],
     deps = [
+        "//aos:make_unique",
         "//aos/logging",
         "//third_party:wpilib_hal",
     ],
diff --git a/frc971/wpilib/ahal/Base.h b/frc971/wpilib/ahal/Base.h
index 3a3d5a2..2d2e5a7 100644
--- a/frc971/wpilib/ahal/Base.h
+++ b/frc971/wpilib/ahal/Base.h
@@ -7,8 +7,6 @@
 
 #pragma once
 
-#include "HAL/cpp/make_unique.h"
-
 namespace frc {
 
 // A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
diff --git a/frc971/wpilib/ahal/DriverStation.cc b/frc971/wpilib/ahal/DriverStation.cc
index f4c2e5d..c34db1b 100644
--- a/frc971/wpilib/ahal/DriverStation.cc
+++ b/frc971/wpilib/ahal/DriverStation.cc
@@ -12,6 +12,7 @@
 #include "FRC_NetworkCommunication/FRCComm.h"
 #include "HAL/HAL.h"
 #include "HAL/Power.h"
+#include "aos/make_unique.h"
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Utility.h"
 #include "frc971/wpilib/ahal/WPIErrors.h"
diff --git a/y2012/BUILD b/y2012/BUILD
index fd9119b..5e85c3d 100644
--- a/y2012/BUILD
+++ b/y2012/BUILD
@@ -6,12 +6,12 @@
         "joystick_reader.cc",
     ],
     deps = [
-        "//aos/time:time",
-        "//aos/actions:action_lib",
-        "//aos/logging",
-        "//aos/util:log_interval",
-        "//aos/input:joystick_input",
         "//aos:init",
+        "//aos/actions:action_lib",
+        "//aos/input:joystick_input",
+        "//aos/logging",
+        "//aos/time",
+        "//aos/util:log_interval",
         "//frc971/autonomous:auto_queue",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//frc971/queues:gyro",
@@ -35,16 +35,17 @@
     ],
     restricted_to = ["//tools:roborio"],
     deps = [
-        "//aos/stl_mutex:stl_mutex",
-        "//aos/time:time",
+        "//aos:init",
+        "//aos:make_unique",
         "//aos/controls:control_loop",
         "//aos/logging",
         "//aos/logging:queue_logging",
-        "//aos/robot_state:robot_state",
+        "//aos/robot_state",
+        "//aos/stl_mutex",
+        "//aos/time",
         "//aos/util:log_interval",
         "//aos/util:phased_loop",
         "//aos/util:wrapping_counter",
-        "//aos:init",
         "//frc971/control_loops:queues",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//frc971/wpilib:buffered_pcm",
diff --git a/y2012/wpilib_interface.cc b/y2012/wpilib_interface.cc
index 6d4fcff..b5be8f4 100644
--- a/y2012/wpilib_interface.cc
+++ b/y2012/wpilib_interface.cc
@@ -19,15 +19,16 @@
 #include "frc971/wpilib/wpilib_robot_base.h"
 #undef ERROR
 
+#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"
 #include "aos/util/log_interval.h"
 #include "aos/util/phased_loop.h"
 #include "aos/util/wrapping_counter.h"
-#include "aos/stl_mutex/stl_mutex.h"
-#include "aos/init.h"
-#include "aos/robot_state/robot_state.q.h"
 
 #include "frc971/control_loops/drivetrain/drivetrain.q.h"
 #include "frc971/wpilib/buffered_pcm.h"
@@ -50,15 +51,11 @@
 using ::frc971::control_loops::drivetrain_queue;
 using ::y2012::control_loops::accessories_queue;
 using namespace frc;
+using aos::make_unique;
 
 namespace y2012 {
 namespace wpilib {
 
-template <class T, class... U>
-std::unique_ptr<T> make_unique(U &&... u) {
-  return std::unique_ptr<T>(new T(std::forward<U>(u)...));
-}
-
 double drivetrain_translate(int32_t in) {
   return -static_cast<double>(in) /
          (256.0 /*cpr*/ * 4.0 /*4x*/) *
diff --git a/y2014/BUILD b/y2014/BUILD
index dfd2325..e4ad2ed 100644
--- a/y2014/BUILD
+++ b/y2014/BUILD
@@ -11,8 +11,8 @@
     visibility = ["//visibility:public"],
     deps = [
         "//aos:once",
-        "//aos/mutex:mutex",
         "//aos/logging",
+        "//aos/mutex",
         "//aos/network:team_number",
         "//frc971:shifter_hall_effect",
         "//frc971/control_loops:state_feedback_loop",
@@ -27,12 +27,12 @@
     ],
     deps = [
         ":constants",
-        "//aos/time:time",
-        "//aos/actions:action_lib",
-        "//aos/logging",
-        "//aos/util:log_interval",
-        "//aos/input:joystick_input",
         "//aos:init",
+        "//aos/actions:action_lib",
+        "//aos/input:joystick_input",
+        "//aos/logging",
+        "//aos/time",
+        "//aos/util:log_interval",
         "//frc971/autonomous:auto_queue",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//frc971/queues:gyro",
@@ -61,10 +61,10 @@
         "hot_goal_reader.cc",
     ],
     deps = [
-        "//aos/time:time",
+        "//aos:init",
         "//aos/logging",
         "//aos/logging:queue_logging",
-        "//aos:init",
+        "//aos/time",
         "//y2014/queues:hot_goal",
     ],
 )
@@ -77,16 +77,17 @@
     restricted_to = ["//tools:roborio"],
     deps = [
         ":constants",
-        "//aos/stl_mutex:stl_mutex",
-        "//aos/time:time",
+        "//aos:init",
+        "//aos:make_unique",
         "//aos/controls:control_loop",
         "//aos/logging",
         "//aos/logging:queue_logging",
-        "//aos/robot_state:robot_state",
+        "//aos/robot_state",
+        "//aos/stl_mutex",
+        "//aos/time",
         "//aos/util:log_interval",
         "//aos/util:phased_loop",
         "//aos/util:wrapping_counter",
-        "//aos:init",
         "//frc971/control_loops:queues",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//frc971/wpilib:buffered_pcm",
diff --git a/y2014/wpilib_interface.cc b/y2014/wpilib_interface.cc
index 2cd9b50..af28012 100644
--- a/y2014/wpilib_interface.cc
+++ b/y2014/wpilib_interface.cc
@@ -18,15 +18,16 @@
 #include "frc971/wpilib/wpilib_robot_base.h"
 #undef ERROR
 
+#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"
 #include "aos/util/log_interval.h"
 #include "aos/util/phased_loop.h"
 #include "aos/util/wrapping_counter.h"
-#include "aos/stl_mutex/stl_mutex.h"
-#include "aos/init.h"
-#include "aos/robot_state/robot_state.q.h"
 
 #include "frc971/shifter_hall_effect.h"
 
@@ -57,6 +58,7 @@
 using ::y2014::control_loops::claw_queue;
 using ::y2014::control_loops::shooter_queue;
 using namespace frc;
+using aos::make_unique;
 
 namespace y2014 {
 namespace wpilib {
@@ -65,13 +67,6 @@
 // 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)...));
-}
-
 double drivetrain_translate(int32_t in) {
   return -static_cast<double>(in) /
          (256.0 /*cpr*/ * 4.0 /*4x*/) *
diff --git a/y2014_bot3/BUILD b/y2014_bot3/BUILD
index f5c5979..f6b5ae6 100644
--- a/y2014_bot3/BUILD
+++ b/y2014_bot3/BUILD
@@ -40,6 +40,7 @@
     restricted_to = ["//tools:roborio"],
     deps = [
         "//aos:init",
+        "//aos:make_unique",
         "//aos/controls:control_loop",
         "//aos/logging",
         "//aos/logging:queue_logging",
diff --git a/y2014_bot3/wpilib_interface.cc b/y2014_bot3/wpilib_interface.cc
index 1d7edc2..ca80b0c 100644
--- a/y2014_bot3/wpilib_interface.cc
+++ b/y2014_bot3/wpilib_interface.cc
@@ -18,15 +18,16 @@
 #include "frc971/wpilib/wpilib_robot_base.h"
 #undef ERROR
 
+#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"
 #include "aos/util/log_interval.h"
 #include "aos/util/phased_loop.h"
 #include "aos/util/wrapping_counter.h"
-#include "aos/stl_mutex/stl_mutex.h"
-#include "aos/init.h"
-#include "aos/robot_state/robot_state.q.h"
 
 #include "frc971/control_loops/drivetrain/drivetrain.q.h"
 #include "y2014_bot3/control_loops/drivetrain/drivetrain_base.h"
@@ -56,6 +57,7 @@
 using ::frc971::wpilib::JoystickSender;
 using ::frc971::wpilib::GyroSender;
 using namespace frc;
+using aos::make_unique;
 
 namespace frc971 {
 namespace wpilib {
@@ -329,13 +331,6 @@
       rollers_back_right_intake_talon_, rollers_low_goal_talon_;
 };
 
-// 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)...));
-}
-
 class WPILibRobot : public ::frc971::wpilib::WPILibRobotBase {
  public:
   ::std::unique_ptr<Encoder> make_encoder(int index) {
diff --git a/y2016/BUILD b/y2016/BUILD
index 0e72985..92f0c86 100644
--- a/y2016/BUILD
+++ b/y2016/BUILD
@@ -1,4 +1,4 @@
-load('//frc971:downloader.bzl', 'robot_downloader')
+load("//frc971:downloader.bzl", "robot_downloader")
 
 cc_library(
     name = "constants",
@@ -11,8 +11,8 @@
     visibility = ["//visibility:public"],
     deps = [
         "//aos:once",
-        "//aos/mutex:mutex",
         "//aos/logging",
+        "//aos/mutex",
         "//aos/network:team_number",
         "//frc971:constants",
         "//frc971:shifter_hall_effect",
@@ -28,12 +28,12 @@
     ],
     deps = [
         ":constants",
-        "//aos/time:time",
-        "//aos/actions:action_lib",
-        "//aos/logging",
-        "//aos/util:log_interval",
-        "//aos/input:joystick_input",
         "//aos:init",
+        "//aos/actions:action_lib",
+        "//aos/input:joystick_input",
+        "//aos/logging",
+        "//aos/time",
+        "//aos/util:log_interval",
         "//frc971/autonomous:auto_queue",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//frc971/queues:gyro",
@@ -48,21 +48,21 @@
 )
 
 robot_downloader(
-  start_binaries = [
-    ':joystick_reader',
-    ':wpilib_interface',
-    '//y2016/control_loops/drivetrain:drivetrain',
-    '//y2016/control_loops/superstructure:superstructure',
-    '//y2016/control_loops/shooter:shooter',
-    '//y2016/dashboard:dashboard',
-    '//y2016/actors:autonomous_action',
-    '//y2016/actors:superstructure_action',
-    '//y2016/actors:vision_align_action',
-    '//y2016/vision:target_receiver',
-  ],
-  dirs = [
-    '//y2016/dashboard:www_files',
-  ],
+    dirs = [
+        "//y2016/dashboard:www_files",
+    ],
+    start_binaries = [
+        ":joystick_reader",
+        ":wpilib_interface",
+        "//y2016/control_loops/drivetrain:drivetrain",
+        "//y2016/control_loops/superstructure:superstructure",
+        "//y2016/control_loops/shooter:shooter",
+        "//y2016/dashboard:dashboard",
+        "//y2016/actors:autonomous_action",
+        "//y2016/actors:superstructure_action",
+        "//y2016/actors:vision_align_action",
+        "//y2016/vision:target_receiver",
+    ],
 )
 
 cc_binary(
@@ -73,17 +73,18 @@
     restricted_to = ["//tools:roborio"],
     deps = [
         ":constants",
+        "//aos:init",
+        "//aos:make_unique",
         "//aos:math",
-        "//aos/stl_mutex:stl_mutex",
-        "//aos/time:time",
         "//aos/controls:control_loop",
         "//aos/logging",
         "//aos/logging:queue_logging",
-        "//aos/robot_state:robot_state",
+        "//aos/robot_state",
+        "//aos/stl_mutex",
+        "//aos/time",
         "//aos/util:log_interval",
         "//aos/util:phased_loop",
         "//aos/util:wrapping_counter",
-        "//aos:init",
         "//frc971/autonomous:auto_queue",
         "//frc971/control_loops:queues",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
diff --git a/y2016/wpilib_interface.cc b/y2016/wpilib_interface.cc
index 320dd73..a4ea3e8 100644
--- a/y2016/wpilib_interface.cc
+++ b/y2016/wpilib_interface.cc
@@ -19,16 +19,17 @@
 #include "frc971/wpilib/wpilib_robot_base.h"
 #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"
 #include "aos/util/log_interval.h"
 #include "aos/util/phased_loop.h"
 #include "aos/util/wrapping_counter.h"
-#include "aos/stl_mutex/stl_mutex.h"
-#include "aos/init.h"
-#include "aos/robot_state/robot_state.q.h"
-#include "aos/commonmath.h"
 
 #include "frc971/autonomous/auto.q.h"
 #include "frc971/control_loops/control_loops.q.h"
@@ -62,6 +63,7 @@
 using ::y2016::control_loops::shooter::shooter_queue;
 using ::y2016::control_loops::superstructure_queue;
 using namespace frc;
+using aos::make_unique;
 
 namespace y2016 {
 namespace wpilib {
@@ -73,13 +75,6 @@
 // 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)...));
-}
-
 // Translates for the sensor values to convert raw index pulses into something
 // with proper units.
 
diff --git a/y2017/BUILD b/y2017/BUILD
index e002758..4e86603 100644
--- a/y2017/BUILD
+++ b/y2017/BUILD
@@ -1,4 +1,4 @@
-load('//frc971:downloader.bzl', 'robot_downloader')
+load("//frc971:downloader.bzl", "robot_downloader")
 
 cc_library(
     name = "constants",
@@ -11,8 +11,8 @@
     visibility = ["//visibility:public"],
     deps = [
         "//aos:once",
-        "//aos/mutex:mutex",
         "//aos/logging",
+        "//aos/mutex",
         "//aos/network:team_number",
         "//frc971:constants",
         "//frc971/shooter_interpolation:interpolation",
@@ -31,13 +31,13 @@
     ],
     deps = [
         ":constants",
-        "//aos/time:time",
+        "//aos:init",
         "//aos/actions:action_lib",
-        "//aos/logging",
-        "//aos/util:log_interval",
         "//aos/input:drivetrain_input",
         "//aos/input:joystick_input",
-        "//aos:init",
+        "//aos/logging",
+        "//aos/time",
+        "//aos/util:log_interval",
         "//frc971/autonomous:auto_queue",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//y2017/actors:autonomous_action_lib",
@@ -54,17 +54,18 @@
     restricted_to = ["//tools:roborio"],
     deps = [
         ":constants",
+        "//aos:init",
+        "//aos:make_unique",
         "//aos:math",
-        "//aos/stl_mutex:stl_mutex",
-        "//aos/time:time",
         "//aos/controls:control_loop",
         "//aos/logging",
         "//aos/logging:queue_logging",
-        "//aos/robot_state:robot_state",
+        "//aos/robot_state",
+        "//aos/stl_mutex",
+        "//aos/time",
         "//aos/util:log_interval",
         "//aos/util:phased_loop",
         "//aos/util:wrapping_counter",
-        "//aos:init",
         "//frc971/autonomous:auto_queue",
         "//frc971/control_loops:queues",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
@@ -86,13 +87,13 @@
 )
 
 robot_downloader(
-  start_binaries = [
-    ':joystick_reader',
-    ':wpilib_interface',
-    '//y2017/control_loops/drivetrain:drivetrain',
-    '//y2017/control_loops/superstructure:superstructure',
-    '//y2017/actors:autonomous_action',
-  ],
+    start_binaries = [
+        ":joystick_reader",
+        ":wpilib_interface",
+        "//y2017/control_loops/drivetrain:drivetrain",
+        "//y2017/control_loops/superstructure:superstructure",
+        "//y2017/actors:autonomous_action",
+    ],
 )
 
 py_library(
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index 4906009..1663ecd 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/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"
@@ -62,6 +63,7 @@
 using ::aos::monotonic_clock;
 namespace chrono = ::std::chrono;
 using namespace frc;
+using aos::make_unique;
 
 namespace y2017 {
 namespace wpilib {
@@ -73,13 +75,6 @@
 // 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>
diff --git a/y2017_bot3/BUILD b/y2017_bot3/BUILD
index aaef43a..9841d08 100644
--- a/y2017_bot3/BUILD
+++ b/y2017_bot3/BUILD
@@ -6,13 +6,13 @@
         "joystick_reader.cc",
     ],
     deps = [
-        "//aos/time:time",
+        "//aos:init",
         "//aos/actions:action_lib",
-        "//aos/logging",
-        "//aos/util:log_interval",
         "//aos/input:drivetrain_input",
         "//aos/input:joystick_input",
-        "//aos:init",
+        "//aos/logging",
+        "//aos/time",
+        "//aos/util:log_interval",
         "//frc971/autonomous:auto_queue",
         "//frc971/autonomous:base_autonomous_actor",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
@@ -29,16 +29,17 @@
     ],
     restricted_to = ["//tools:roborio"],
     deps = [
+        "//aos:init",
+        "//aos:make_unique",
         "//aos:math",
-        "//aos/stl_mutex:stl_mutex",
-        "//aos/time:time",
         "//aos/controls:control_loop",
         "//aos/logging",
         "//aos/logging:queue_logging",
-        "//aos/robot_state:robot_state",
+        "//aos/robot_state",
+        "//aos/stl_mutex",
+        "//aos/time",
         "//aos/util:log_interval",
         "//aos/util:phased_loop",
-        "//aos:init",
         "//frc971/control_loops:queues",
         "//frc971/control_loops/drivetrain:drivetrain_queue",
         "//frc971/wpilib:buffered_pcm",
diff --git a/y2017_bot3/wpilib_interface.cc b/y2017_bot3/wpilib_interface.cc
index 48787b4..c3c4f37 100644
--- a/y2017_bot3/wpilib_interface.cc
+++ b/y2017_bot3/wpilib_interface.cc
@@ -19,15 +19,16 @@
 #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"
 #include "aos/util/compiler_memory_barrier.h"
 #include "aos/util/log_interval.h"
 #include "aos/util/phased_loop.h"
-#include "aos/init.h"
 
 #include "frc971/control_loops/control_loops.q.h"
 #include "frc971/control_loops/drivetrain/drivetrain.q.h"
@@ -58,6 +59,7 @@
 using ::aos::monotonic_clock;
 namespace chrono = ::std::chrono;
 using namespace frc;
+using aos::make_unique;
 
 namespace y2017_bot3 {
 namespace wpilib {
@@ -79,13 +81,6 @@
 // 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>
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;