Dedulicate make_unique

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

Change-Id: I0436ce8fd477bbb27d9b0a7c4832dad01c9bad35
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_