@@ -8,6 +8,7 @@ 
 #ifndef __LIBCAMERA_CONTROLS_H__
 #define __LIBCAMERA_CONTROLS_H__
 
+#include <assert.h>
 #include <string>
 #include <unordered_map>
 
@@ -70,9 +71,19 @@  public:
 	}
 
 	template<typename T>
-	T get() const;
+	T get() const
+	{
+		assert(type_ == details::control_type<std::remove_cv_t<T>>::value);
+
+		return *reinterpret_cast<const T *>(&bool_);
+	}
+
 	template<typename T>
-	void set(const T &value);
+	void set(const T &value)
+	{
+		type_ = details::control_type<std::remove_cv_t<T>>::value;
+		*reinterpret_cast<T *>(&bool_) = value;
+	}
 
 private:
 	ControlType type_;
@@ -175,53 +175,6 @@  bool ControlValue::operator==(const ControlValue &other) const
  * \param[in] value The control value
  */
 
-#ifndef __DOXYGEN__
-template<>
-bool ControlValue::get<bool>() const
-{
-	ASSERT(type_ == ControlTypeBool);
-
-	return bool_;
-}
-
-template<>
-int32_t ControlValue::get<int32_t>() const
-{
-	ASSERT(type_ == ControlTypeInteger32);
-
-	return integer32_;
-}
-
-template<>
-int64_t ControlValue::get<int64_t>() const
-{
-	ASSERT(type_ == ControlTypeInteger64);
-
-	return integer64_;
-}
-
-template<>
-void ControlValue::set<bool>(const bool &value)
-{
-	type_ = ControlTypeBool;
-	bool_ = value;
-}
-
-template<>
-void ControlValue::set<int32_t>(const int32_t &value)
-{
-	type_ = ControlTypeInteger32;
-	integer32_ = value;
-}
-
-template<>
-void ControlValue::set<int64_t>(const int64_t &value)
-{
-	type_ = ControlTypeInteger64;
-	integer64_ = value;
-}
-#endif /* __DOXYGEN__ */
-
 /**
  * \class ControlId
  * \brief Control static metadata