+/**
+ * Bool to integral/float doesn't need any special checks, and this
+ * overload means we aren't trying to see if a bool is less than
+ * an integer.
+ */
+template <class Tgt>
+typename std::enable_if<
+ !std::is_same<Tgt, bool>::value &&
+ (std::is_integral<Tgt>::value || std::is_floating_point<Tgt>::value),
+ Expected<Tgt, ConversionCode>>::type
+convertTo(const bool& value) noexcept {
+ return static_cast<Tgt>(value ? 1 : 0);
+}
+